From e5215804ded0102f6d6f3d694374ae5e106fd9c0 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 1 Nov 2005 22:01:28 -0800 Subject: Do not put automatic merge message after signed-off-by line. 'git-commit -s' after a failed automerge inserted the automerge message in a wrong place. The signed-off-by line should come last. Signed-off-by: Junio C Hamano --- git-commit.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/git-commit.sh b/git-commit.sh index 10651d87d0..daf90f1e58 100755 --- a/git-commit.sh +++ b/git-commit.sh @@ -129,6 +129,9 @@ then elif test "$use_commit" != "" then git-cat-file commit "$use_commit" | sed -e '1,/^$/d' +elif test -f "$GIT_DIR/MERGE_HEAD" && test -f "$GIT_DIR/MERGE_MSG" +then + cat "$GIT_DIR/MERGE_MSG" fi | git-stripspace >"$GIT_DIR"/COMMIT_EDITMSG case "$signoff" in @@ -144,9 +147,6 @@ t) esac if [ -f "$GIT_DIR/MERGE_HEAD" ]; then - - test -f "$GIT_DIR/MERGE_MSG" && cat "$GIT_DIR/MERGE_MSG" - echo "#" echo "# It looks like your may be committing a MERGE." echo "# If this is not correct, please remove the file" -- cgit v1.2.3 From e125c1a717bb732319596d8b792a67c2b7b15ef7 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 1 Nov 2005 22:19:36 -0800 Subject: git-clone: do not forget to create origin branch. The newly cloned repository by default had .git/remotes/origin set up to track the remote master to origin, but forgot to create the origin branch ourselves. Also it hardcoded the assumption that the remote HEAD points at "master", which may not always be true. Signed-off-by: Junio C Hamano --- git-clone.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/git-clone.sh b/git-clone.sh index 18e692a67b..c27a913b1d 100755 --- a/git-clone.sh +++ b/git-clone.sh @@ -196,10 +196,17 @@ cd $D || exit if test -f ".git/HEAD" then - mkdir -p .git/remotes || exit - echo >.git/remotes/origin \ - "URL: $repo -Pull: master:origin" + head_points_at=`git-symbolic-ref HEAD` + case "$head_points_at" in + refs/heads/*) + head_points_at=`expr "$head_points_at" : 'refs/heads/\(.*\)'` + mkdir -p .git/remotes && + echo >.git/remotes/origin \ + "URL: $repo +Pull: $head_points_at:origin" + cp ".git/refs/heads/$head_points_at" .git/refs/heads/origin + esac + case "$no_checkout" in '') git checkout -- cgit v1.2.3 From 4ccafd7a02fd9905cc5382b2c1d5abdb11a7525a Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 2 Nov 2005 12:01:06 -0800 Subject: Make test-date buildable again. Now we define and use our own ctype-replacement, we need to link with it. Signed-off-by: Junio C Hamano --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 357cb3ec8c..488ee365c9 100644 --- a/Makefile +++ b/Makefile @@ -397,8 +397,8 @@ doc: test: all $(MAKE) -C t/ all -test-date$X: test-date.c date.o - $(CC) $(ALL_CFLAGS) -o $@ test-date.c date.o +test-date$X: test-date.c date.o ctype.o + $(CC) $(ALL_CFLAGS) -o $@ test-date.c date.o ctype.o test-delta$X: test-delta.c diff-delta.o patch-delta.o $(CC) $(ALL_CFLAGS) -o $@ $^ -- cgit v1.2.3 From 13d1cc3604a1a64cb5a6025bba8af8b74a373963 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 2 Nov 2005 12:17:47 -0800 Subject: Do not fail on hierarchical branch names. "git-checkout -b frotz/nitfol master" failed to create $GIT_DIR/refs/heads/frotz/nitfol but went ahead and updated $GIT_DIR/HEAD to point at it, resulting in a corrupt repository. Exit when we cannot create the new branch with an error status. While we are at it, there is no reason to forbid subdirectories in refs/heads, so make sure we handle that correctly. Signed-off-by: Junio C Hamano --- git-branch.sh | 2 ++ git-checkout.sh | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/git-branch.sh b/git-branch.sh index e2db9063d4..67f113acb9 100755 --- a/git-branch.sh +++ b/git-branch.sh @@ -102,4 +102,6 @@ rev=$(git-rev-parse --verify "$head") || exit git-check-ref-format "heads/$branchname" || die "we do not like '$branchname' as a branch name." +leading=`expr "refs/heads/$branchname" : '\(.*\)/'` && +mkdir -p "$GIT_DIR/$leading" && echo $rev > "$GIT_DIR/refs/heads/$branchname" diff --git a/git-checkout.sh b/git-checkout.sh index cb33fdc7e2..4c08f36b59 100755 --- a/git-checkout.sh +++ b/git-checkout.sh @@ -126,7 +126,9 @@ fi # if [ "$?" -eq 0 ]; then if [ "$newbranch" ]; then - echo $new > "$GIT_DIR/refs/heads/$newbranch" + leading=`expr "refs/heads/$newbranch" : '\(.*\)/'` && + mkdir -p "$GIT_DIR/$leading" && + echo $new >"$GIT_DIR/refs/heads/$newbranch" || exit branch="$newbranch" fi [ "$branch" ] && -- cgit v1.2.3 From d317e4384acd5646f2ba44197a531c129b26b57e Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Wed, 2 Nov 2005 14:05:45 +0100 Subject: remove CR/LF from .gitignore For everyone cursed by dos/windows line endings (aka CRLF): The code reading the .gitignore files (excludes and excludes per directory) leaves \r in the patterns, which causes fnmatch to fail for no obvious reason. Just remove a "\r" preceding a "\n" unconditionally. Signed-off-by: Junio C Hamano --- ls-files.c | 2 +- t/t3001-ls-files-others-exclude.sh | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ls-files.c b/ls-files.c index 3085b2fc8c..d9c8b215f1 100644 --- a/ls-files.c +++ b/ls-files.c @@ -97,7 +97,7 @@ static int add_excludes_from_file_1(const char *fname, for (i = 0; i < size; i++) { if (buf[i] == '\n') { if (entry != buf + i && entry[0] != '#') { - buf[i] = 0; + buf[i - (i && buf[i-1] == '\r')] = 0; add_exclude(entry, base, baselen, which); } entry = buf + i + 1; diff --git a/t/t3001-ls-files-others-exclude.sh b/t/t3001-ls-files-others-exclude.sh index 5beaaa3375..fde2bb25fa 100755 --- a/t/t3001-ls-files-others-exclude.sh +++ b/t/t3001-ls-files-others-exclude.sh @@ -67,4 +67,16 @@ test_expect_success \ >output && diff -u expect output' +# Test \r\n (MSDOS-like systems) +echo -ne '*.1\r\n/*.3\r\n!*.6\r\n' >.gitignore + +test_expect_success \ + 'git-ls-files --others with \r\n line endings.' \ + 'git-ls-files --others \ + --exclude=\*.6 \ + --exclude-per-directory=.gitignore \ + --exclude-from=.git/ignore \ + >output && + diff -u expect output' + test_done -- cgit v1.2.3 From db2c075d9375a32b8010d2b17c1d420aa8696710 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 2 Nov 2005 13:02:57 -0800 Subject: Ignore '\r' at the end of line in $GIT_DIR/config Unfortunate people may have to use $GIT_DIR/config edited on DOSsy machine on UNIXy machine. Ignore '\r' immediately followed by '\n'. Signed-off-by: Junio C Hamano --- config.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config.c b/config.c index 519fecfee4..e89bab26c9 100644 --- a/config.c +++ b/config.c @@ -13,6 +13,14 @@ static int get_next_char(void) c = '\n'; if ((f = config_file) != NULL) { c = fgetc(f); + if (c == '\r') { + /* DOS like systems */ + c = fgetc(f); + if (c != '\n') { + ungetc(c, f); + c = '\r'; + } + } if (c == '\n') config_linenr++; if (c == EOF) { -- cgit v1.2.3 From 2fd955cc0b49de9e64b2f073ce76033975f0be24 Mon Sep 17 00:00:00 2001 From: Peter Eriksen Date: Wed, 2 Nov 2005 20:27:31 +0100 Subject: [PATCH] Clean up the SunOS Makefile rule Don't set a non-standard CURLDIR as default, and fix an error in Solaris 10 by setting NEEDS_LIBICONV. Signed-off-by: Peter Eriksen Signed-off-by: Junio C Hamano --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 488ee365c9..be6101ab23 100644 --- a/Makefile +++ b/Makefile @@ -189,9 +189,9 @@ endif ifeq ($(uname_S),SunOS) NEEDS_SOCKET = YesPlease NEEDS_NSL = YesPlease + NEEDS_LIBICONV = YesPlease SHELL_PATH = /bin/bash NO_STRCASESTR = YesPlease - CURLDIR = /opt/sfw INSTALL = ginstall TAR = gtar PLATFORM_DEFINES += -D__EXTENSIONS__ -- cgit v1.2.3 From 9534f40bc42dd826cc26c8c8c84f6a8a5fc569f6 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 2 Nov 2005 15:19:13 -0800 Subject: Be careful when dereferencing tags. One caller of deref_tag() was not careful enough to make sure what deref_tag() returned was not NULL (i.e. we found a tag object that points at an object we do not have). Fix it, and warn about refs that point at such an incomplete tag where needed. Signed-off-by: Junio C Hamano --- commit.c | 2 +- fetch-pack.c | 7 ++++--- name-rev.c | 2 +- send-pack.c | 4 ++-- server-info.c | 7 ++++--- sha1_name.c | 2 +- tag.c | 7 ++++++- tag.h | 2 +- upload-pack.c | 2 +- 9 files changed, 21 insertions(+), 14 deletions(-) diff --git a/commit.c b/commit.c index 8f403180e5..a8c9bfc8ba 100644 --- a/commit.c +++ b/commit.c @@ -55,7 +55,7 @@ static struct commit *check_commit(struct object *obj, struct commit *lookup_commit_reference_gently(const unsigned char *sha1, int quiet) { - struct object *obj = deref_tag(parse_object(sha1)); + struct object *obj = deref_tag(parse_object(sha1), NULL, 0); if (!obj) return NULL; diff --git a/fetch-pack.c b/fetch-pack.c index 3df991100b..cb2171523c 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -38,9 +38,9 @@ static void rev_list_push(struct commit *commit, int mark) static int rev_list_insert_ref(const char *path, const unsigned char *sha1) { - struct object *o = deref_tag(parse_object(sha1)); + struct object *o = deref_tag(parse_object(sha1), path, 0); - if (o->type == commit_type) + if (o && o->type == commit_type) rev_list_push((struct commit *)o, SEEN); return 0; @@ -317,7 +317,8 @@ static int everything_local(struct ref **refs, int nr_match, char **match) * Don't mark them common yet; the server has to be told so first. */ for (ref = *refs; ref; ref = ref->next) { - struct object *o = deref_tag(lookup_object(ref->old_sha1)); + struct object *o = deref_tag(lookup_object(ref->old_sha1), + NULL, 0); if (!o || o->type != commit_type || !(o->flags & COMPLETE)) continue; diff --git a/name-rev.c b/name-rev.c index 21fecdf542..59194f1349 100644 --- a/name-rev.c +++ b/name-rev.c @@ -164,7 +164,7 @@ int main(int argc, char **argv) continue; } - o = deref_tag(parse_object(sha1)); + o = deref_tag(parse_object(sha1), *argv, 0); if (!o || o->type != commit_type) { fprintf(stderr, "Could not get commit for %s. Skipping.\n", *argv); diff --git a/send-pack.c b/send-pack.c index 9f9a6e70b8..3eeb18f7c7 100644 --- a/send-pack.c +++ b/send-pack.c @@ -126,12 +126,12 @@ static int ref_newer(const unsigned char *new_sha1, /* Both new and old must be commit-ish and new is descendant of * old. Otherwise we require --force. */ - o = deref_tag(parse_object(old_sha1)); + o = deref_tag(parse_object(old_sha1), NULL, 0); if (!o || o->type != commit_type) return 0; old = (struct commit *) o; - o = deref_tag(parse_object(new_sha1)); + o = deref_tag(parse_object(new_sha1), NULL, 0); if (!o || o->type != commit_type) return 0; new = (struct commit *) o; diff --git a/server-info.c b/server-info.c index ba5359108d..0cba8e19f7 100644 --- a/server-info.c +++ b/server-info.c @@ -13,9 +13,10 @@ static int add_info_ref(const char *path, const unsigned char *sha1) fprintf(info_ref_fp, "%s %s\n", sha1_to_hex(sha1), path); if (o->type == tag_type) { - o = deref_tag(o); - fprintf(info_ref_fp, "%s %s^{}\n", - sha1_to_hex(o->sha1), path); + o = deref_tag(o, path, 0); + if (o) + fprintf(info_ref_fp, "%s %s^{}\n", + sha1_to_hex(o->sha1), path); } return 0; } diff --git a/sha1_name.c b/sha1_name.c index fe409fbce4..be1755a70b 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -349,7 +349,7 @@ static int peel_onion(const char *name, int len, unsigned char *sha1) if (!o) return -1; if (!type_string) { - o = deref_tag(o); + o = deref_tag(o, name, sp - name - 2); if (!o || (!o->parsed && !parse_object(o->sha1))) return -1; memcpy(sha1, o->sha1, 20); diff --git a/tag.c b/tag.c index b1ab75ff01..e574c4b7a4 100644 --- a/tag.c +++ b/tag.c @@ -3,10 +3,15 @@ const char *tag_type = "tag"; -struct object *deref_tag(struct object *o) +struct object *deref_tag(struct object *o, const char *warn, int warnlen) { while (o && o->type == tag_type) o = parse_object(((struct tag *)o)->tagged->sha1); + if (!o && warn) { + if (!warnlen) + warnlen = strlen(warn); + error("missing object referenced by '%.*s'", warnlen, warn); + } return o; } diff --git a/tag.h b/tag.h index 36e532401f..7a0cb0070d 100644 --- a/tag.h +++ b/tag.h @@ -15,6 +15,6 @@ struct tag { extern struct tag *lookup_tag(const unsigned char *sha1); extern int parse_tag_buffer(struct tag *item, void *data, unsigned long size); extern int parse_tag(struct tag *item); -extern struct object *deref_tag(struct object *); +extern struct object *deref_tag(struct object *, const char *, int); #endif /* TAG_H */ diff --git a/upload-pack.c b/upload-pack.c index c5eff21363..be63132804 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -226,7 +226,7 @@ static int send_ref(const char *refname, const unsigned char *sha1) nr_our_refs++; } if (o->type == tag_type) { - o = deref_tag(o); + o = deref_tag(o, refname, 0); packet_write(1, "%s %s^{}\n", sha1_to_hex(o->sha1), refname); } return 0; -- cgit v1.2.3 From a3114b3428595710d4719dd668531210af5993c9 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 2 Nov 2005 23:41:25 -0800 Subject: Document --since and --until options to rev-parse. The usability magic were hidden in the source code without being documented, and even the maintainer did not know about them ;-). Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 099db294f4..dfe21391aa 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -72,6 +72,14 @@ OPTIONS path of the current directory relative to the top-level directory. +--since=datestring, --after=datestring:: + Parses the date string, and outputs corresponding + --max-age= parameter for git-rev-list command. + +--until=datestring, --before=datestring:: + Parses the date string, and outputs corresponding + --min-age= parameter for git-rev-list command. + ...:: Flags and parameters to be parsed. -- cgit v1.2.3 From 123ee3ca7b57c32bb3ecd8cfede20dbb9dd5a8a8 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 1 Nov 2005 19:30:11 -0800 Subject: Add --no-commit to git-merge/git-pull. With --no-commit flag, git-pull will perform the merge but pretends as if the merge needed a hand resolve even if automerge cleanly resolves, to give the user a chance to add further changes and edit the commit message. Signed-off-by: Junio C Hamano --- git-merge.sh | 28 ++++++++++++++++++---------- git-pull.sh | 6 ++++-- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/git-merge.sh b/git-merge.sh index 6ad96ebfbb..dd104db7ad 100755 --- a/git-merge.sh +++ b/git-merge.sh @@ -9,7 +9,7 @@ LF=' ' usage () { - die "git-merge [-n] [-s ]... +" + die "git-merge [-n] [--no-commit] [-s ]... +" } # all_strategies='resolve recursive stupid octopus' @@ -63,6 +63,8 @@ do -n|--n|--no|--no-|--no-s|--no-su|--no-sum|--no-summ|\ --no-summa|--no-summar|--no-summary) no_summary=t ;; + --no-c|--no-co|--no-com|--no-comm|--no-commi|--no-commit) + no_commit=t ;; -s=*|--s=*|--st=*|--str=*|--stra=*|--strat=*|--strate=*|\ --strateg=*|--strategy=*|\ -s|--s|--st|--str|--stra|--strat|--strate|--strateg|--strategy) @@ -111,18 +113,18 @@ done common=$(git-show-branch --merge-base $head "$@") echo "$head" >"$GIT_DIR/ORIG_HEAD" -case "$#,$common" in -*,'') +case "$#,$common,$no_commit" in +*,'',*) # No common ancestors found. We need a real merge. ;; -1,"$1") +1,"$1",*) # If head can reach all the merge then we are up to date. # but first the most common case of merging one remote echo "Already up-to-date." dropsave exit 0 ;; -1,"$head") +1,"$head",*) # Again the most common case of merging one remote. echo "Updating from $head to $1." git-update-index --refresh 2>/dev/null @@ -132,11 +134,11 @@ case "$#,$common" in dropsave exit 0 ;; -1,?*"$LF"?*) +1,?*"$LF"?*,*) # We are not doing octopus and not fast forward. Need a # real merge. ;; -1,*) +1,*,) # We are not doing octopus, not fast forward, and have only # one common. See if it is really trivial. echo "Trying really trivial in-index merge..." @@ -210,12 +212,18 @@ do # Remember which strategy left the state in the working tree wt_strategy=$strategy - git-merge-$strategy $common -- "$head_arg" "$@" || { + git-merge-$strategy $common -- "$head_arg" "$@" + exit=$? + if test "$no_commit" = t && test "$exit" = 0 + then + exit=1 ;# pretend it left conflicts. + fi + + test "$exit" = 0 || { # The backend exits with 1 when conflicts are left to be resolved, # with 2 when it does not handle the given merge at all. - exit=$? if test "$exit" -eq 1 then cnt=`{ @@ -272,4 +280,4 @@ do done >"$GIT_DIR/MERGE_HEAD" echo $merge_msg >"$GIT_DIR/MERGE_MSG" -die "Automatic merge failed; fix up by hand" +die "Automatic merge failed/prevented; fix up by hand" diff --git a/git-pull.sh b/git-pull.sh index d4765188b4..96016270b4 100755 --- a/git-pull.sh +++ b/git-pull.sh @@ -10,13 +10,15 @@ usage () { die "git pull [-n] [-s strategy]... ..." } -strategy_args= no_summary= +strategy_args= no_summary= no_commit= while case "$#,$1" in 0) break ;; *,-*) ;; *) break ;; esac do case "$1" in -n|--n|--no|--no-|--no-s|--no-su|--no-sum|--no-summ|\ --no-summa|--no-summar|--no-summary) no_summary=-n ;; + --no-c|--no-co|--no-com|--no-comm|--no-commi|--no-commit) + no_commit=--no-commit ;; -s=*|--s=*|--st=*|--str=*|--stra=*|--strat=*|--strate=*|\ --strateg=*|--strategy=*|\ -s|--s|--st|--str|--stra|--strat|--strate|--strateg|--strategy) @@ -81,4 +83,4 @@ case "$strategy_args" in esac merge_name=$(git-fmt-merge-msg <"$GIT_DIR/FETCH_HEAD") -git-merge $no_summary $strategy_args "$merge_name" HEAD $merge_head +git-merge $no_summary $no_commit $strategy_args "$merge_name" HEAD $merge_head -- cgit v1.2.3 From 64da9e604eea25c9c20cfe12618285ccd0bf3cfe Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 1 Nov 2005 19:34:49 -0800 Subject: Add 'ours' merge strategy. This adds the coolest merge strategy ever, "ours". It can take arbitrary number of foreign heads and merge them into the current branch, with the resulting tree always taken from our branch head, hence its name. What this means is that you can declare that the current branch supersedes the development histories of other branches using this merge strategy. Signed-off-by: Junio C Hamano --- .gitignore | 1 + Makefile | 2 +- git-merge-ours.sh | 7 +++++++ git-merge.sh | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) create mode 100755 git-merge-ours.sh diff --git a/.gitignore b/.gitignore index 927c89cbac..3edf6b41af 100644 --- a/.gitignore +++ b/.gitignore @@ -50,6 +50,7 @@ git-merge-base git-merge-index git-merge-octopus git-merge-one-file +git-merge-ours git-merge-recursive git-merge-resolve git-merge-stupid diff --git a/Makefile b/Makefile index be6101ab23..6c01dc2953 100644 --- a/Makefile +++ b/Makefile @@ -89,7 +89,7 @@ SCRIPT_SH = \ git-tag.sh git-verify-tag.sh git-whatchanged.sh git.sh \ git-applymbox.sh git-applypatch.sh git-am.sh \ git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \ - git-merge-resolve.sh git-grep.sh + git-merge-resolve.sh git-merge-ours.sh git-grep.sh SCRIPT_PERL = \ git-archimport.perl git-cvsimport.perl git-relink.perl \ diff --git a/git-merge-ours.sh b/git-merge-ours.sh new file mode 100755 index 0000000000..a64704f3e5 --- /dev/null +++ b/git-merge-ours.sh @@ -0,0 +1,7 @@ +#!/bin/sh +# +# Copyright (c) 2005 Junio C Hamano +# +# Pretend we resolved the heads, but declare our tree trumps everybody else. +# +exit 0 diff --git a/git-merge.sh b/git-merge.sh index dd104db7ad..b810fceaf8 100755 --- a/git-merge.sh +++ b/git-merge.sh @@ -14,7 +14,7 @@ usage () { # all_strategies='resolve recursive stupid octopus' -all_strategies='recursive octopus resolve stupid' +all_strategies='recursive octopus resolve stupid ours' default_strategies='resolve octopus' use_strategies= -- cgit v1.2.3 From 160252f81626d865b9e902abffe5e4976944c930 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 3 Nov 2005 01:51:25 -0800 Subject: git-merge-ours: make sure our index matches HEAD git-merge expects this check to be done appropriately by the merge strategy backends. In the case of merge-ours strategy, the resulting tree comes what we have in the index file, so it must match the current HEAD; otherwise it would not be "ours" merge. Signed-off-by: Junio C Hamano --- git-merge-ours.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/git-merge-ours.sh b/git-merge-ours.sh index a64704f3e5..4f3d053889 100755 --- a/git-merge-ours.sh +++ b/git-merge-ours.sh @@ -4,4 +4,11 @@ # # Pretend we resolved the heads, but declare our tree trumps everybody else. # + +# We need to exit with 2 if the index does not match our HEAD tree, +# because the current index is what we will be committing as the +# merge result. + +test "$(git-diff-index --cached --name-status HEAD)" = "" || exit 2 + exit 0 -- cgit v1.2.3 From 66158e331b385a81ac825c208c6160a0cdd2324c Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 3 Nov 2005 13:52:44 -0800 Subject: Illustration: "Fundamental Git Index Operations" Jon Loeliger's ASCII art in the Discussion section. Signed-off-by: Junio C Hamano --- README | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/README b/README index 0ee49d4898..4a2616ba57 100644 --- a/README +++ b/README @@ -399,6 +399,46 @@ save the note about that state, in practice we tend to just write the result to the file `.git/HEAD`, so that we can always see what the last committed state was. +Here is an ASCII art by Jon Loeliger that illustrates how +various pieces fit together. + +------------ + + commit-tree + commit obj + +----+ + | | + | | + V V + +-----------+ + | Object DB | + | Backing | + | Store | + +-----------+ + ^ + write-tree | | + tree obj | | + | | read-tree + | | tree obj + V + +-----------+ + | Index | + | "cache" | + +-----------+ + update-index ^ + blob obj | | + | | + checkout-index -u | | checkout-index + stat | | blob obj + V + +-----------+ + | Working | + | Directory | + +-----------+ + +------------ + + 6) Examining the data ~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.2.3 From 36f05ef485d023eda3bf750e7b207d07d5feb39d Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 3 Nov 2005 13:52:44 -0800 Subject: Illustration: "Git Diff Types" Jon Loeliger's ASCII art in the Tutorial. Signed-off-by: Junio C Hamano --- Documentation/tutorial.txt | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/Documentation/tutorial.txt b/Documentation/tutorial.txt index 20a4cb1df4..214673db06 100644 --- a/Documentation/tutorial.txt +++ b/Documentation/tutorial.txt @@ -455,6 +455,41 @@ the same diff that we've already seen several times, we can now do (again, `-p` means to show the difference as a human-readable patch), and it will show what the last commit (in `HEAD`) actually changed. +[NOTE] +============ +Here is an ASCII art by Jon Loeliger that illustrates how +various diff-\* commands compare things. + + diff-tree + +----+ + | | + | | + V V + +-----------+ + | Object DB | + | Backing | + | Store | + +-----------+ + ^ ^ + | | + | | diff-index --cached + | | + diff-index | V + | +-----------+ + | | Index | + | | "cache" | + | +-----------+ + | ^ + | | + | | diff-files + | | + V V + +-----------+ + | Working | + | Directory | + +-----------+ +============ + More interestingly, you can also give `git-diff-tree` the `-v` flag, which tells it to also show the commit message and author and date of the commit, and you can tell it to show a whole series of diffs. -- cgit v1.2.3 From 2be8fd085e865097fa0908fe1a94c8edf9cde7f5 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 3 Nov 2005 13:52:44 -0800 Subject: Illustration: "Commit DAG Revision Naming" Jon Loeliger's ASCII art in the git-rev-parse(1) manual. Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index dfe21391aa..431b8f6e06 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -132,6 +132,32 @@ which is passed to 'git-rev-list'. Two revision parameters concatenated with '..' is a short-hand for writing a range between them. I.e. 'r1..r2' is equivalent to saying '{caret}r1 r2' +Here is an illustration, by Jon Loeliger. Both node B and C are +a commit parents of commit node A. Parent commits are ordered +left-to-right. + + G H I J + \ / \ / + D E F + \ | / + \ | / + \|/ + B C + \ / + \ / + A + + A = = A^0 + B = A^ = A^1 = A~1 + C = A^2 = A^2 + D = A^^ = A^1^1 = A~2 + E = B^2 = A^^2 + F = B^3 = A^^3 + G = A^^^ = A^1^1^1 = A~3 + H = D^2 = B^^2 = A^^^2 = A~2^2 + I = F^ = B^3^ = A^^3^ + J = F^2 = B^3^2 = A^^3^2 + Author ------ -- cgit v1.2.3