projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Strip useless "tags/" prefix from git-tag -l output
[git.git]
/
update-index.c
diff --git
a/update-index.c
b/update-index.c
index
5496d68
..
3d7e02d
100644
(file)
--- a/
update-index.c
+++ b/
update-index.c
@@
-382,7
+382,7
@@
static void update_one(const char *path, const char *prefix, int prefix_length)
die("Unable to process file %s", path);
report("add '%s'", path);
free_return:
die("Unable to process file %s", path);
report("add '%s'", path);
free_return:
- if (p
!= path
)
+ if (p
< path || p > path + strlen(path)
)
free((char*)p);
}
free((char*)p);
}
@@
-596,7
+596,7
@@
static int do_unresolve(int ac, const char **av,
const char *arg = av[i];
const char *p = prefix_path(prefix, prefix_length, arg);
err |= unresolve_one(p);
const char *arg = av[i];
const char *p = prefix_path(prefix, prefix_length, arg);
err |= unresolve_one(p);
- if (p
!= arg
)
+ if (p
< arg || p > arg + strlen(arg)
)
free((char*)p);
}
return err;
free((char*)p);
}
return err;
@@
-610,6
+610,7
@@
static int do_reupdate(int ac, const char **av,
*/
int pos;
int has_head = 1;
*/
int pos;
int has_head = 1;
+ const char **pathspec = get_pathspec(prefix, av + 1);
if (read_ref(git_path("HEAD"), head_sha1))
/* If there is no HEAD, that means it is an initial
if (read_ref(git_path("HEAD"), head_sha1))
/* If there is no HEAD, that means it is an initial
@@
-621,7
+622,8
@@
static int do_reupdate(int ac, const char **av,
struct cache_entry *ce = active_cache[pos];
struct cache_entry *old = NULL;
int save_nr;
struct cache_entry *ce = active_cache[pos];
struct cache_entry *old = NULL;
int save_nr;
- if (ce_stage(ce))
+
+ if (ce_stage(ce) || !ce_path_match(ce, pathspec))
continue;
if (has_head)
old = read_one_ent(NULL, head_sha1,
continue;
if (has_head)
old = read_one_ent(NULL, head_sha1,
@@
-800,7
+802,7
@@
int main(int argc, const char **argv)
update_one(p, NULL, 0);
if (set_executable_bit)
chmod_path(set_executable_bit, p);
update_one(p, NULL, 0);
if (set_executable_bit)
chmod_path(set_executable_bit, p);
- if (p
!= path_name
)
+ if (p
< path_name || p > path_name + strlen(path_name)
)
free((char*) p);
if (path_name != buf.buf)
free(path_name);
free((char*) p);
if (path_name != buf.buf)
free(path_name);