Skip to content

Commit 455d0f5

Browse files
committed
Merge branch 'maint'
* maint: sha1_file.c: resolve confusion EACCES vs EPERM sha1_file: avoid bogus "file exists" error message git checkout: don't warn about unborn branch if -f is already passed bash: offer refs instead of filenames for 'git revert' bash: remove dashed command leftovers git-p4: fix keyword-expansion regex fast-export: use an unsorted string list for extra_refs Add new testcase to show fast-export does not always exports all tags
2 parents 608efb8 + 539eec4 commit 455d0f5

File tree

6 files changed

+22
-39
lines changed

6 files changed

+22
-39
lines changed

builtin-checkout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ static int switch_branches(struct checkout_opts *opts, struct branch_info *new)
553553
if (!opts->quiet && !old.path && old.commit && new->commit != old.commit)
554554
describe_detached_head("Previous HEAD position was", old.commit);
555555

556-
if (!old.commit) {
556+
if (!old.commit && !opts->force) {
557557
if (!opts->quiet) {
558558
fprintf(stderr, "warning: You appear to be on a branch yet to be born.\n");
559559
fprintf(stderr, "warning: Forcing checkout of %s.\n", new->name);

builtin-fast-export.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ static void get_tags_and_duplicates(struct object_array *pending,
354354
case OBJ_TAG:
355355
tag = (struct tag *)e->item;
356356
while (tag && tag->object.type == OBJ_TAG) {
357-
string_list_insert(full_name, extra_refs)->util = tag;
357+
string_list_append(full_name, extra_refs)->util = tag;
358358
tag = (struct tag *)tag->tagged;
359359
}
360360
if (!tag)
@@ -374,7 +374,7 @@ static void get_tags_and_duplicates(struct object_array *pending,
374374
}
375375
if (commit->util)
376376
/* more than one name for the same object */
377-
string_list_insert(full_name, extra_refs)->util = commit;
377+
string_list_append(full_name, extra_refs)->util = commit;
378378
else
379379
commit->util = full_name;
380380
}

contrib/completion/git-completion.bash

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -647,21 +647,12 @@ _git_branch ()
647647

648648
_git_bundle ()
649649
{
650-
local mycword="$COMP_CWORD"
651-
case "${COMP_WORDS[0]}" in
652-
git)
653-
local cmd="${COMP_WORDS[2]}"
654-
mycword="$((mycword-1))"
655-
;;
656-
git-bundle*)
657-
local cmd="${COMP_WORDS[1]}"
658-
;;
659-
esac
660-
case "$mycword" in
661-
1)
650+
local cmd="${COMP_WORDS[2]}"
651+
case "$COMP_CWORD" in
652+
2)
662653
__gitcomp "create list-heads verify unbundle"
663654
;;
664-
2)
655+
3)
665656
# looking for a file
666657
;;
667658
*)
@@ -809,12 +800,7 @@ _git_fetch ()
809800
__gitcomp "$(__git_refs)" "$pfx" "${cur#*:}"
810801
;;
811802
*)
812-
local remote
813-
case "${COMP_WORDS[0]}" in
814-
git-fetch) remote="${COMP_WORDS[1]}" ;;
815-
git) remote="${COMP_WORDS[2]}" ;;
816-
esac
817-
__gitcomp "$(__git_refs2 "$remote")"
803+
__gitcomp "$(__git_refs2 "${COMP_WORDS[2]}")"
818804
;;
819805
esac
820806
fi
@@ -1058,12 +1044,7 @@ _git_pull ()
10581044
if [ "$COMP_CWORD" = 2 ]; then
10591045
__gitcomp "$(__git_remotes)"
10601046
else
1061-
local remote
1062-
case "${COMP_WORDS[0]}" in
1063-
git-pull) remote="${COMP_WORDS[1]}" ;;
1064-
git) remote="${COMP_WORDS[2]}" ;;
1065-
esac
1066-
__gitcomp "$(__git_refs "$remote")"
1047+
__gitcomp "$(__git_refs "${COMP_WORDS[2]}")"
10671048
fi
10681049
}
10691050

@@ -1076,19 +1057,13 @@ _git_push ()
10761057
else
10771058
case "$cur" in
10781059
*:*)
1079-
local remote
1080-
case "${COMP_WORDS[0]}" in
1081-
git-push) remote="${COMP_WORDS[1]}" ;;
1082-
git) remote="${COMP_WORDS[2]}" ;;
1083-
esac
1084-
10851060
local pfx=""
10861061
case "$COMP_WORDBREAKS" in
10871062
*:*) : great ;;
10881063
*) pfx="${cur%%:*}:" ;;
10891064
esac
10901065

1091-
__gitcomp "$(__git_refs "$remote")" "$pfx" "${cur#*:}"
1066+
__gitcomp "$(__git_refs "${COMP_WORDS[2]}")" "$pfx" "${cur#*:}"
10921067
;;
10931068
+*)
10941069
__gitcomp "$(__git_refs)" + "${cur#+}"
@@ -1368,7 +1343,7 @@ _git_revert ()
13681343
return
13691344
;;
13701345
esac
1371-
COMPREPLY=()
1346+
__gitcomp "$(__git_refs)"
13721347
}
13731348

13741349
_git_rm ()
@@ -1590,7 +1565,7 @@ _git_tag ()
15901565
-m|-F)
15911566
COMPREPLY=()
15921567
;;
1593-
-*|tag|git-tag)
1568+
-*|tag)
15941569
if [ $f = 1 ]; then
15951570
__gitcomp "$(__git_tags)"
15961571
else

contrib/fast-import/git-p4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ class P4Sync(Command):
981981
if stat['type'] in ('text+ko', 'unicode+ko', 'binary+ko'):
982982
text = re.sub(r'(?i)\$(Id|Header):[^$]*\$',r'$\1$', text)
983983
elif stat['type'] in ('text+k', 'ktext', 'kxtext', 'unicode+k', 'binary+k'):
984-
text = re.sub(r'\$(Id|Header|Author|Date|DateTime|Change|File|Revision):[^$]*\$',r'$\1$', text)
984+
text = re.sub(r'\$(Id|Header|Author|Date|DateTime|Change|File|Revision):[^$\n]*\$',r'$\1$', text)
985985

986986
contents[stat['depotFile']] = text
987987

sha1_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2315,7 +2315,7 @@ static int write_loose_object(const unsigned char *sha1, char *hdr, int hdrlen,
23152315
filename = sha1_file_name(sha1);
23162316
fd = create_tmpfile(tmpfile, sizeof(tmpfile), filename);
23172317
if (fd < 0) {
2318-
if (errno == EPERM)
2318+
if (errno == EACCES)
23192319
return error("insufficient permission for adding an object to repository database %s\n", get_object_directory());
23202320
else
23212321
return error("unable to create temporary sha1 filename %s: %s\n", tmpfile, strerror(errno));

t/t9301-fast-export.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,4 +231,12 @@ test_expect_success 'fast-export -C -C | fast-import' '
231231
232232
'
233233

234+
test_expect_success 'fast-export | fast-import when master is tagged' '
235+
236+
git tag -m msg last &&
237+
git fast-export -C -C --signed-tags=strip --all > output &&
238+
test $(grep -c "^tag " output) = 3
239+
240+
'
241+
234242
test_done

0 commit comments

Comments
 (0)