Skip to content

Commit 77e6f5b

Browse files
author
Junio C Hamano
committed
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"
2 parents 33580fb + b5da246 commit 77e6f5b

17 files changed

+98
-19
lines changed

Documentation/git-rev-list.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ SYNOPSIS
2121
[ \--stdin ]
2222
[ \--topo-order ]
2323
[ \--parents ]
24+
[ \--left-right ]
2425
[ \--encoding[=<encoding>] ]
2526
[ \--(author|committer|grep)=<pattern> ]
2627
[ [\--objects | \--objects-edge] [ \--unpacked ] ]
@@ -101,6 +102,36 @@ include::pretty-formats.txt[]
101102

102103
Print the parents of the commit.
103104

105+
--left-right::
106+
107+
Mark which side of a symmetric diff a commit is reachable from.
108+
Commits from the left side are prefixed with `<` and those from
109+
the right with `>`. If combined with `--boundary`, those
110+
commits are prefixed with `-`.
111+
+
112+
For example, if you have this topology:
113+
+
114+
-----------------------------------------------------------------------
115+
y---b---b branch B
116+
/ \ /
117+
/ .
118+
/ / \
119+
o---x---a---a branch A
120+
-----------------------------------------------------------------------
121+
+
122+
you would get an output line this:
123+
+
124+
-----------------------------------------------------------------------
125+
$ git rev-list --left-right --boundary --pretty=oneline A...B
126+
127+
>bbbbbbb... 3rd on b
128+
>bbbbbbb... 2nd on b
129+
<aaaaaaa... 3rd on a
130+
<aaaaaaa... 2nd on a
131+
-yyyyyyy... 1st on b
132+
-xxxxxxx... 1st on a
133+
-----------------------------------------------------------------------
134+
104135
Diff Formatting
105136
~~~~~~~~~~~~~~~
106137

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ help.o: common-cmds.h
727727
$(BUILT_INS): git$X
728728
$(QUIET_BUILT_IN)rm -f $@ && ln git$X $@
729729

730-
common-cmds.h: Documentation/git-*.txt
730+
common-cmds.h: $(wildcard Documentation/git-*.txt)
731731
$(QUIET_GEN)./generate-cmdlist.sh > $@+ && mv $@+ $@
732732

733733
$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh

builtin-apply.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ static int gitdiff_hdrend(const char *line, struct patch *patch)
417417
static char *gitdiff_verify_name(const char *line, int isnull, char *orig_name, const char *oldnew)
418418
{
419419
if (!orig_name && !isnull)
420-
return find_name(line, NULL, 1, TERM_TAB);
420+
return find_name(line, NULL, p_value, TERM_TAB);
421421

422422
if (orig_name) {
423423
int len;
@@ -427,7 +427,7 @@ static char *gitdiff_verify_name(const char *line, int isnull, char *orig_name,
427427
len = strlen(name);
428428
if (isnull)
429429
die("git-apply: bad git-diff - expected /dev/null, got %s on line %d", name, linenr);
430-
another = find_name(line, NULL, 1, TERM_TAB);
430+
another = find_name(line, NULL, p_value, TERM_TAB);
431431
if (!another || memcmp(another, name, len))
432432
die("git-apply: bad git-diff - inconsistent %s filename on line %d", oldnew, linenr);
433433
free(another);

builtin-archive.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ int cmd_archive(int argc, const char **argv, const char *prefix)
252252

253253
memset(&ar, 0, sizeof(ar));
254254
tree_idx = parse_archive_args(argc, argv, &ar);
255+
if (prefix == NULL)
256+
prefix = setup_git_directory();
255257

256258
argv += tree_idx;
257259
parse_treeish_arg(argv, &ar.args, prefix);

builtin-rerere.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,13 @@ static int handle_file(const char *path,
117117
else if (!prefixcmp(buf, "======="))
118118
hunk = 2;
119119
else if (!prefixcmp(buf, ">>>>>>> ")) {
120+
int one_is_longer = (one->nr > two->nr);
121+
int common_len = one_is_longer ? two->nr : one->nr;
122+
int cmp = memcmp(one->ptr, two->ptr, common_len);
123+
120124
hunk_no++;
121125
hunk = 0;
122-
if (memcmp(one->ptr, two->ptr, one->nr < two->nr ?
123-
one->nr : two->nr) > 0) {
126+
if ((cmp > 0) || ((cmp == 0) && one_is_longer)) {
124127
struct buffer *swap = one;
125128
one = two;
126129
two = swap;

builtin-rev-list.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ static const char rev_list_usage[] =
3535
" --header | --pretty\n"
3636
" --abbrev=nr | --no-abbrev\n"
3737
" --abbrev-commit\n"
38+
" --left-right\n"
3839
" special purpose:\n"
3940
" --bisect\n"
4041
" --bisect-vars"

config.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -916,8 +916,8 @@ int git_config_rename_section(const char *old_name, const char *new_name)
916916
}
917917

918918
if (!(config_file = fopen(config_filename, "rb"))) {
919-
ret = error("Could not open config file!");
920-
goto out;
919+
/* no config file means nothing to rename, no error */
920+
goto unlock_and_out;
921921
}
922922

923923
while (fgets(buf, sizeof(buf), config_file)) {
@@ -951,6 +951,7 @@ int git_config_rename_section(const char *old_name, const char *new_name)
951951
}
952952
}
953953
fclose(config_file);
954+
unlock_and_out:
954955
if (close(out_fd) || commit_lock_file(lock) < 0)
955956
ret = error("Cannot commit config file!");
956957
out:

contrib/emacs/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ emacsdir = $(prefix)/share/emacs/site-lisp
1111
all: $(ELC)
1212

1313
install: all
14-
$(INSTALL) -d $(emacsdir)
15-
$(INSTALL_ELC) $(ELC) $(emacsdir)
14+
$(INSTALL) -d $(DESTDIR)$(emacsdir)
15+
$(INSTALL_ELC) $(ELC) $(DESTDIR)$(emacsdir)
1616

1717
%.elc: %.el
1818
$(EMACS) -batch -f batch-byte-compile $<
File renamed without changes.

git.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
226226
{ "add", cmd_add, RUN_SETUP | NOT_BARE },
227227
{ "annotate", cmd_annotate, USE_PAGER },
228228
{ "apply", cmd_apply },
229-
{ "archive", cmd_archive, RUN_SETUP },
229+
{ "archive", cmd_archive },
230230
{ "blame", cmd_blame, RUN_SETUP },
231231
{ "branch", cmd_branch, RUN_SETUP },
232232
{ "bundle", cmd_bundle },

0 commit comments

Comments
 (0)