summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-04-05 23:34:51 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-04-05 23:34:51 (GMT)
commit77e6f5bc1009aa588a3b2235758bf5be13b23d85 (patch)
treecb040ac72459291eda6adf1aa9f10778bc54cdbf
parent33580fbd308593e36395926fd35b501976ad322a (diff)
parentb5da24679ec73f458988523dce9dd17b4e9b0e02 (diff)
downloadgit-77e6f5bc1009aa588a3b2235758bf5be13b23d85.zip
git-77e6f5bc1009aa588a3b2235758bf5be13b23d85.tar.gz
git-77e6f5bc1009aa588a3b2235758bf5be13b23d85.tar.bz2
Merge branch 'maint'
* maint: Fix lseek(2) calls with args 2 and 3 swapped Honor -p<n> when applying git diffs Fix dependency of common-cmds.h Fix renaming branch without config file DESTDIR support for git/contrib/emacs gitweb: Fix bug in "blobdiff" view for split (e.g. file to symlink) patches Document --left-right option to rev-list. Revert "builtin-archive: use RUN_SETUP" rename contrib/hooks/post-receieve-email to contrib/hooks/post-receive-email. rerere: make sorting really stable. Fix t4200-rerere for white-space from "wc -l"
-rw-r--r--Documentation/git-rev-list.txt31
-rw-r--r--Makefile2
-rw-r--r--builtin-apply.c4
-rw-r--r--builtin-archive.c2
-rw-r--r--builtin-rerere.c7
-rw-r--r--builtin-rev-list.c1
-rw-r--r--config.c5
-rw-r--r--contrib/emacs/Makefile4
-rw-r--r--contrib/hooks/post-receive-email (renamed from contrib/hooks/post-receieve-email)0
-rw-r--r--git.c2
-rwxr-xr-xgitweb/gitweb.perl6
-rw-r--r--http-fetch.c2
-rw-r--r--http-push.c2
-rwxr-xr-xt/t3200-branch.sh9
-rwxr-xr-xt/t4120-apply-popt.sh25
-rwxr-xr-xt/t4200-rerere.sh11
-rwxr-xr-xt/t5000-tar-tree.sh4
17 files changed, 98 insertions, 19 deletions
diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt
index 3fa45b8..12b71ed 100644
--- a/Documentation/git-rev-list.txt
+++ b/Documentation/git-rev-list.txt
@@ -21,6 +21,7 @@ SYNOPSIS
[ \--stdin ]
[ \--topo-order ]
[ \--parents ]
+ [ \--left-right ]
[ \--encoding[=<encoding>] ]
[ \--(author|committer|grep)=<pattern> ]
[ [\--objects | \--objects-edge] [ \--unpacked ] ]
@@ -101,6 +102,36 @@ include::pretty-formats.txt[]
Print the parents of the commit.
+--left-right::
+
+ Mark which side of a symmetric diff a commit is reachable from.
+ Commits from the left side are prefixed with `<` and those from
+ the right with `>`. If combined with `--boundary`, those
+ commits are prefixed with `-`.
++
+For example, if you have this topology:
++
+-----------------------------------------------------------------------
+ y---b---b branch B
+ / \ /
+ / .
+ / / \
+ o---x---a---a branch A
+-----------------------------------------------------------------------
++
+you would get an output line this:
++
+-----------------------------------------------------------------------
+ $ git rev-list --left-right --boundary --pretty=oneline A...B
+
+ >bbbbbbb... 3rd on b
+ >bbbbbbb... 2nd on b
+ <aaaaaaa... 3rd on a
+ <aaaaaaa... 2nd on a
+ -yyyyyyy... 1st on b
+ -xxxxxxx... 1st on a
+-----------------------------------------------------------------------
+
Diff Formatting
~~~~~~~~~~~~~~~
diff --git a/Makefile b/Makefile
index 507ad91..45dbcf6 100644
--- a/Makefile
+++ b/Makefile
@@ -727,7 +727,7 @@ help.o: common-cmds.h
$(BUILT_INS): git$X
$(QUIET_BUILT_IN)rm -f $@ && ln git$X $@
-common-cmds.h: Documentation/git-*.txt
+common-cmds.h: $(wildcard Documentation/git-*.txt)
$(QUIET_GEN)./generate-cmdlist.sh > $@+ && mv $@+ $@
$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
diff --git a/builtin-apply.c b/builtin-apply.c
index 6a8292e..4b8311b 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -417,7 +417,7 @@ static int gitdiff_hdrend(const char *line, struct patch *patch)
static char *gitdiff_verify_name(const char *line, int isnull, char *orig_name, const char *oldnew)
{
if (!orig_name && !isnull)
- return find_name(line, NULL, 1, TERM_TAB);
+ return find_name(line, NULL, p_value, TERM_TAB);
if (orig_name) {
int len;
@@ -427,7 +427,7 @@ static char *gitdiff_verify_name(const char *line, int isnull, char *orig_name,
len = strlen(name);
if (isnull)
die("git-apply: bad git-diff - expected /dev/null, got %s on line %d", name, linenr);
- another = find_name(line, NULL, 1, TERM_TAB);
+ another = find_name(line, NULL, p_value, TERM_TAB);
if (!another || memcmp(another, name, len))
die("git-apply: bad git-diff - inconsistent %s filename on line %d", oldnew, linenr);
free(another);
diff --git a/builtin-archive.c b/builtin-archive.c
index 2fae885..8ea6cb1 100644
--- a/builtin-archive.c
+++ b/builtin-archive.c
@@ -252,6 +252,8 @@ int cmd_archive(int argc, const char **argv, const char *prefix)
memset(&ar, 0, sizeof(ar));
tree_idx = parse_archive_args(argc, argv, &ar);
+ if (prefix == NULL)
+ prefix = setup_git_directory();
argv += tree_idx;
parse_treeish_arg(argv, &ar.args, prefix);
diff --git a/builtin-rerere.c b/builtin-rerere.c
index b463c07..8c2c8bd 100644
--- a/builtin-rerere.c
+++ b/builtin-rerere.c
@@ -117,10 +117,13 @@ static int handle_file(const char *path,
else if (!prefixcmp(buf, "======="))
hunk = 2;
else if (!prefixcmp(buf, ">>>>>>> ")) {
+ int one_is_longer = (one->nr > two->nr);
+ int common_len = one_is_longer ? two->nr : one->nr;
+ int cmp = memcmp(one->ptr, two->ptr, common_len);
+
hunk_no++;
hunk = 0;
- if (memcmp(one->ptr, two->ptr, one->nr < two->nr ?
- one->nr : two->nr) > 0) {
+ if ((cmp > 0) || ((cmp == 0) && one_is_longer)) {
struct buffer *swap = one;
one = two;
two = swap;
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index f91685a..09774f9 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -35,6 +35,7 @@ static const char rev_list_usage[] =
" --header | --pretty\n"
" --abbrev=nr | --no-abbrev\n"
" --abbrev-commit\n"
+" --left-right\n"
" special purpose:\n"
" --bisect\n"
" --bisect-vars"
diff --git a/config.c b/config.c
index 6479855..70d1055 100644
--- a/config.c
+++ b/config.c
@@ -916,8 +916,8 @@ int git_config_rename_section(const char *old_name, const char *new_name)
}
if (!(config_file = fopen(config_filename, "rb"))) {
- ret = error("Could not open config file!");
- goto out;
+ /* no config file means nothing to rename, no error */
+ goto unlock_and_out;
}
while (fgets(buf, sizeof(buf), config_file)) {
@@ -951,6 +951,7 @@ int git_config_rename_section(const char *old_name, const char *new_name)
}
}
fclose(config_file);
+ unlock_and_out:
if (close(out_fd) || commit_lock_file(lock) < 0)
ret = error("Cannot commit config file!");
out:
diff --git a/contrib/emacs/Makefile b/contrib/emacs/Makefile
index 8554e39..98aa0aa 100644
--- a/contrib/emacs/Makefile
+++ b/contrib/emacs/Makefile
@@ -11,8 +11,8 @@ emacsdir = $(prefix)/share/emacs/site-lisp
all: $(ELC)
install: all
- $(INSTALL) -d $(emacsdir)
- $(INSTALL_ELC) $(ELC) $(emacsdir)
+ $(INSTALL) -d $(DESTDIR)$(emacsdir)
+ $(INSTALL_ELC) $(ELC) $(DESTDIR)$(emacsdir)
%.elc: %.el
$(EMACS) -batch -f batch-byte-compile $<
diff --git a/contrib/hooks/post-receieve-email b/contrib/hooks/post-receive-email
index 6516015..6516015 100644
--- a/contrib/hooks/post-receieve-email
+++ b/contrib/hooks/post-receive-email
diff --git a/git.c b/git.c
index 5b1bc2a..33dd4d3 100644
--- a/git.c
+++ b/git.c
@@ -226,7 +226,7 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
{ "add", cmd_add, RUN_SETUP | NOT_BARE },
{ "annotate", cmd_annotate, USE_PAGER },
{ "apply", cmd_apply },
- { "archive", cmd_archive, RUN_SETUP },
+ { "archive", cmd_archive },
{ "blame", cmd_blame, RUN_SETUP },
{ "branch", cmd_branch, RUN_SETUP },
{ "bundle", cmd_bundle },
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index ea49156..e49eb91 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -3934,7 +3934,8 @@ sub git_blobdiff {
# open patch output
open $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts,
- '-p', $hash_parent_base, $hash_base,
+ '-p', ($format eq 'html' ? "--full-index" : ()),
+ $hash_parent_base, $hash_base,
"--", (defined $file_parent ? $file_parent : ()), $file_name
or die_error(undef, "Open git-diff-tree failed");
}
@@ -3969,7 +3970,8 @@ sub git_blobdiff {
}
# open patch output
- open $fd, "-|", git_cmd(), "diff", '-p', @diff_opts,
+ open $fd, "-|", git_cmd(), "diff", @diff_opts,
+ '-p', ($format eq 'html' ? "--full-index" : ()),
$hash_parent, $hash, "--"
or die_error(undef, "Open git-diff failed");
} else {
diff --git a/http-fetch.c b/http-fetch.c
index 557b403..09baedc 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -198,7 +198,7 @@ static void start_object_request(struct object_request *obj_req)
SHA1_Init(&obj_req->c);
if (prev_posn>0) {
prev_posn = 0;
- lseek(obj_req->local, SEEK_SET, 0);
+ lseek(obj_req->local, 0, SEEK_SET);
ftruncate(obj_req->local, 0);
}
}
diff --git a/http-push.c b/http-push.c
index 724720c..e3f7675 100644
--- a/http-push.c
+++ b/http-push.c
@@ -312,7 +312,7 @@ static void start_fetch_loose(struct transfer_request *request)
SHA1_Init(&request->c);
if (prev_posn>0) {
prev_posn = 0;
- lseek(request->local_fileno, SEEK_SET, 0);
+ lseek(request->local_fileno, 0, SEEK_SET);
ftruncate(request->local_fileno, 0);
}
}
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index 9558bdb..ce2c5f4 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -83,6 +83,15 @@ test_expect_failure \
git-branch r &&
git-branch -m q r/q'
+mv .git/config .git/config-saved
+
+test_expect_success 'git branch -m q Q without config should succeed' '
+ git-branch -m q Q &&
+ git-branch -m Q q
+'
+
+mv .git/config-saved .git/config
+
git-config branch.s/s.dummy Hello
test_expect_success \
diff --git a/t/t4120-apply-popt.sh b/t/t4120-apply-popt.sh
new file mode 100755
index 0000000..2f672f3
--- /dev/null
+++ b/t/t4120-apply-popt.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 Shawn O. Pearce
+#
+
+test_description='git-apply -p handling.'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+ mkdir sub &&
+ echo A >sub/file1 &&
+ cp sub/file1 file1 &&
+ git add sub/file1 &&
+ echo B >sub/file1 &&
+ git diff >patch.file &&
+ rm sub/file1 &&
+ rmdir sub
+'
+
+test_expect_success 'apply git diff with -p2' '
+ git apply -p2 patch.file
+'
+
+test_done
diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh
index 8b611bb..6ba63d7 100755
--- a/t/t4200-rerere.sh
+++ b/t/t4200-rerere.sh
@@ -35,7 +35,8 @@ git commit -q -a -m first
git checkout -b second master
git show first:a1 |
-sed -e 's/To die, t/To die! T/' -e 's/life;$/life./' > a1
+sed -e 's/To die, t/To die! T/' > a1
+echo "* END *" >>a1
git commit -q -a -m second
# activate rerere
@@ -50,10 +51,10 @@ test_expect_success 'recorded preimage' "grep ======= $rr/preimage"
test_expect_success 'no postimage or thisimage yet' \
"test ! -f $rr/postimage -a ! -f $rr/thisimage"
-test_expect_success 'preimage have right number of lines' '
+test_expect_success 'preimage has right number of lines' '
cnt=$(sed -ne "/^<<<<<<</,/^>>>>>>>/p" $rr/preimage | wc -l) &&
- test "$cnt" = 10
+ test $cnt = 9
'
@@ -75,10 +76,10 @@ cat > expect << EOF
For in that sleep of death what dreams may come
When we have shuffled off this mortal coil,
Must give us pause: there's the respect
+ That makes calamity of so long life;
-<<<<<<<
--That makes calamity of so long life.
-=======
- That makes calamity of so long life;
+-* END *
->>>>>>>
EOF
git rerere diff > out
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index ac835fe..b4359df 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -130,4 +130,8 @@ test_expect_success \
'validate file contents with prefix' \
'diff -r a e/prefix/a'
+test_expect_success \
+ 'git-archive --list outside of a git repo' \
+ 'GIT_DIR=some/non-existing/directory git-archive --list'
+
test_done