summaryrefslogtreecommitdiff
path: root/builtin-reset.c
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2007-11-03 14:33:01 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-11-06 06:47:22 (GMT)
commitcdf4a751fa728273030651a769f9f45212ff50c9 (patch)
tree50b4cc8b762614039347b5749b6e10ad3b9993a2 /builtin-reset.c
parentfe61935007b6803ce116e233316e4ff51de02be6 (diff)
downloadgit-cdf4a751fa728273030651a769f9f45212ff50c9.zip
git-cdf4a751fa728273030651a769f9f45212ff50c9.tar.gz
git-cdf4a751fa728273030651a769f9f45212ff50c9.tar.bz2
builtin-reset: do not call "ls-files --unmerged"
Since reset is a builtin now, it can use the full power of libgit.a and check for unmerged entries itself. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-reset.c')
-rw-r--r--builtin-reset.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/builtin-reset.c b/builtin-reset.c
index 5467e36..79792ee 100644
--- a/builtin-reset.c
+++ b/builtin-reset.c
@@ -46,26 +46,14 @@ static inline int is_merge(void)
static int unmerged_files(void)
{
- char b;
- ssize_t len;
- struct child_process cmd;
- const char *argv_ls_files[] = {"ls-files", "--unmerged", NULL};
-
- memset(&cmd, 0, sizeof(cmd));
- cmd.argv = argv_ls_files;
- cmd.git_cmd = 1;
- cmd.out = -1;
-
- if (start_command(&cmd))
- die("Could not run sub-command: git ls-files");
-
- len = xread(cmd.out, &b, 1);
- if (len < 0)
- die("Could not read output from git ls-files: %s",
- strerror(errno));
- finish_command(&cmd);
-
- return len;
+ int i;
+ read_cache();
+ for (i = 0; i < active_nr; i++) {
+ struct cache_entry *ce = active_cache[i];
+ if (ce_stage(ce))
+ return 1;
+ }
+ return 0;
}
static int reset_index_file(const unsigned char *sha1, int is_hard_reset)