diff options
author | Junio C Hamano <junkio@cox.net> | 2006-08-26 01:08:39 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-08-26 01:08:39 -0700 |
commit | b4c27c186f6282ead5d2af0cfd9b6015b011bc38 (patch) | |
tree | 4ad1f74af2cd95e8cf0ee82a4b06d6c1ffae5611 /diff.c | |
parent | 903acca75329841996bbf0c3a32a7cfeb3ae0d0f (diff) | |
parent | a7f051987c5f020e60da1e5d6ddefc3d443d3299 (diff) | |
download | git-b4c27c186f6282ead5d2af0cfd9b6015b011bc38.tar.gz |
Merge branch 'master' into gl/web
* master: (34 commits)
gitweb: git_annotate didn't expect negative numeric timezone
git-svn: add the 'dcommit' command
git-svn: recommend rebase for syncing against an SVN repo
git-svn: establish new connections on commit after fork
describe: fix off-by-one error in --abbrev=40 handling
git-svn(1): improve asciidoc markup
gitview.txt: improve asciidoc markup
git(7): put the synopsis in a verse style paragraph
gitk(1): expand the manpage to look less like a template
git-blame(1): mention options in the synopsis and advertise pickaxe
git-ls-remote(1): document --upload-pack
git-apply(1): document missing options and improve existing ones
update-index -g
n is in fact unused, and is later shadowed.
use name[len] in switch directly, instead of creating a shadowed variable.
builtin-grep.c: remove unused debugging piece.
remove ugly shadowing of loop indexes in subloops.
missing 'static' keywords
git_dir holds pointers to local strings, hence MUST be const.
avoid to use error that shadows the function name, use err instead.
...
Diffstat (limited to 'diff.c')
-rw-r--r-- | diff.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -1101,7 +1101,7 @@ void fill_filespec(struct diff_filespec *spec, const unsigned char *sha1, { if (mode) { spec->mode = canon_mode(mode); - memcpy(spec->sha1, sha1, 20); + hashcpy(spec->sha1, sha1); spec->sha1_valid = !is_null_sha1(sha1); } } @@ -1140,7 +1140,7 @@ static int work_tree_matches(const char *name, const unsigned char *sha1) if ((lstat(name, &st) < 0) || !S_ISREG(st.st_mode) || /* careful! */ ce_match_stat(ce, &st, 0) || - memcmp(sha1, ce->sha1, 20)) + hashcmp(sha1, ce->sha1)) return 0; /* we return 1 only when we can stat, it is a regular file, * stat information matches, and sha1 recorded in the cache @@ -1168,7 +1168,7 @@ static struct sha1_size_cache *locate_size_cache(unsigned char *sha1, while (last > first) { int cmp, next = (last + first) >> 1; e = sha1_size_cache[next]; - cmp = memcmp(e->sha1, sha1, 20); + cmp = hashcmp(e->sha1, sha1); if (!cmp) return e; if (cmp < 0) { @@ -1194,7 +1194,7 @@ static struct sha1_size_cache *locate_size_cache(unsigned char *sha1, sizeof(*sha1_size_cache)); e = xmalloc(sizeof(struct sha1_size_cache)); sha1_size_cache[first] = e; - memcpy(e->sha1, sha1, 20); + hashcpy(e->sha1, sha1); e->size = size; return e; } @@ -1516,7 +1516,7 @@ static void diff_fill_sha1_info(struct diff_filespec *one) } } else - memset(one->sha1, 0, 20); + hashclr(one->sha1); } static void run_diff(struct diff_filepair *p, struct diff_options *o) @@ -1579,7 +1579,7 @@ static void run_diff(struct diff_filepair *p, struct diff_options *o) ; } - if (memcmp(one->sha1, two->sha1, 20)) { + if (hashcmp(one->sha1, two->sha1)) { int abbrev = o->full_index ? 40 : DEFAULT_ABBREV; len += snprintf(msg + len, sizeof(msg) - len, @@ -2098,7 +2098,7 @@ int diff_unmodified_pair(struct diff_filepair *p) * dealing with a change. */ if (one->sha1_valid && two->sha1_valid && - !memcmp(one->sha1, two->sha1, sizeof(one->sha1))) + !hashcmp(one->sha1, two->sha1)) return 1; /* no change */ if (!one->sha1_valid && !two->sha1_valid) return 1; /* both look at the same file on the filesystem. */ @@ -2237,7 +2237,7 @@ static void diff_resolve_rename_copy(void) if (!p->status) p->status = DIFF_STATUS_RENAMED; } - else if (memcmp(p->one->sha1, p->two->sha1, 20) || + else if (hashcmp(p->one->sha1, p->two->sha1) || p->one->mode != p->two->mode) p->status = DIFF_STATUS_MODIFIED; else { |