Browse Source

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
maint
Junio C Hamano 16 years ago
parent
commit
455d0f5c23
  1. 2
      builtin-checkout.c
  2. 4
      builtin-fast-export.c
  3. 43
      contrib/completion/git-completion.bash
  4. 2
      contrib/fast-import/git-p4
  5. 2
      sha1_file.c
  6. 8
      t/t9301-fast-export.sh

2
builtin-checkout.c

@ -553,7 +553,7 @@ static int switch_branches(struct checkout_opts *opts, struct branch_info *new) @@ -553,7 +553,7 @@ static int switch_branches(struct checkout_opts *opts, struct branch_info *new)
if (!opts->quiet && !old.path && old.commit && new->commit != old.commit)
describe_detached_head("Previous HEAD position was", old.commit);

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

4
builtin-fast-export.c

@ -354,7 +354,7 @@ static void get_tags_and_duplicates(struct object_array *pending, @@ -354,7 +354,7 @@ static void get_tags_and_duplicates(struct object_array *pending,
case OBJ_TAG:
tag = (struct tag *)e->item;
while (tag && tag->object.type == OBJ_TAG) {
string_list_insert(full_name, extra_refs)->util = tag;
string_list_append(full_name, extra_refs)->util = tag;
tag = (struct tag *)tag->tagged;
}
if (!tag)
@ -374,7 +374,7 @@ static void get_tags_and_duplicates(struct object_array *pending, @@ -374,7 +374,7 @@ static void get_tags_and_duplicates(struct object_array *pending,
}
if (commit->util)
/* more than one name for the same object */
string_list_insert(full_name, extra_refs)->util = commit;
string_list_append(full_name, extra_refs)->util = commit;
else
commit->util = full_name;
}

43
contrib/completion/git-completion.bash

@ -647,21 +647,12 @@ _git_branch () @@ -647,21 +647,12 @@ _git_branch ()

_git_bundle ()
{
local mycword="$COMP_CWORD"
case "${COMP_WORDS[0]}" in
git)
local cmd="${COMP_WORDS[2]}"
mycword="$((mycword-1))"
;;
git-bundle*)
local cmd="${COMP_WORDS[1]}"
;;
esac
case "$mycword" in
1)
local cmd="${COMP_WORDS[2]}"
case "$COMP_CWORD" in
2)
__gitcomp "create list-heads verify unbundle"
;;
2)
3)
# looking for a file
;;
*)
@ -809,12 +800,7 @@ _git_fetch () @@ -809,12 +800,7 @@ _git_fetch ()
__gitcomp "$(__git_refs)" "$pfx" "${cur#*:}"
;;
*)
local remote
case "${COMP_WORDS[0]}" in
git-fetch) remote="${COMP_WORDS[1]}" ;;
git) remote="${COMP_WORDS[2]}" ;;
esac
__gitcomp "$(__git_refs2 "$remote")"
__gitcomp "$(__git_refs2 "${COMP_WORDS[2]}")"
;;
esac
fi
@ -1058,12 +1044,7 @@ _git_pull () @@ -1058,12 +1044,7 @@ _git_pull ()
if [ "$COMP_CWORD" = 2 ]; then
__gitcomp "$(__git_remotes)"
else
local remote
case "${COMP_WORDS[0]}" in
git-pull) remote="${COMP_WORDS[1]}" ;;
git) remote="${COMP_WORDS[2]}" ;;
esac
__gitcomp "$(__git_refs "$remote")"
__gitcomp "$(__git_refs "${COMP_WORDS[2]}")"
fi
}

@ -1076,19 +1057,13 @@ _git_push () @@ -1076,19 +1057,13 @@ _git_push ()
else
case "$cur" in
*:*)
local remote
case "${COMP_WORDS[0]}" in
git-push) remote="${COMP_WORDS[1]}" ;;
git) remote="${COMP_WORDS[2]}" ;;
esac

local pfx=""
case "$COMP_WORDBREAKS" in
*:*) : great ;;
*) pfx="${cur%%:*}:" ;;
esac

__gitcomp "$(__git_refs "$remote")" "$pfx" "${cur#*:}"
__gitcomp "$(__git_refs "${COMP_WORDS[2]}")" "$pfx" "${cur#*:}"
;;
+*)
__gitcomp "$(__git_refs)" + "${cur#+}"
@ -1368,7 +1343,7 @@ _git_revert () @@ -1368,7 +1343,7 @@ _git_revert ()
return
;;
esac
COMPREPLY=()
__gitcomp "$(__git_refs)"
}

_git_rm ()
@ -1590,7 +1565,7 @@ _git_tag () @@ -1590,7 +1565,7 @@ _git_tag ()
-m|-F)
COMPREPLY=()
;;
-*|tag|git-tag)
-*|tag)
if [ $f = 1 ]; then
__gitcomp "$(__git_tags)"
else

2
contrib/fast-import/git-p4

@ -981,7 +981,7 @@ class P4Sync(Command): @@ -981,7 +981,7 @@ class P4Sync(Command):
if stat['type'] in ('text+ko', 'unicode+ko', 'binary+ko'):
text = re.sub(r'(?i)\$(Id|Header):[^$]*\$',r'$\1$', text)
elif stat['type'] in ('text+k', 'ktext', 'kxtext', 'unicode+k', 'binary+k'):
text = re.sub(r'\$(Id|Header|Author|Date|DateTime|Change|File|Revision):[^$]*\$',r'$\1$', text)
text = re.sub(r'\$(Id|Header|Author|Date|DateTime|Change|File|Revision):[^$\n]*\$',r'$\1$', text)

contents[stat['depotFile']] = text


2
sha1_file.c

@ -2315,7 +2315,7 @@ static int write_loose_object(const unsigned char *sha1, char *hdr, int hdrlen, @@ -2315,7 +2315,7 @@ static int write_loose_object(const unsigned char *sha1, char *hdr, int hdrlen,
filename = sha1_file_name(sha1);
fd = create_tmpfile(tmpfile, sizeof(tmpfile), filename);
if (fd < 0) {
if (errno == EPERM)
if (errno == EACCES)
return error("insufficient permission for adding an object to repository database %s\n", get_object_directory());
else
return error("unable to create temporary sha1 filename %s: %s\n", tmpfile, strerror(errno));

8
t/t9301-fast-export.sh

@ -231,4 +231,12 @@ test_expect_success 'fast-export -C -C | fast-import' ' @@ -231,4 +231,12 @@ test_expect_success 'fast-export -C -C | fast-import' '

'

test_expect_success 'fast-export | fast-import when master is tagged' '

git tag -m msg last &&
git fast-export -C -C --signed-tags=strip --all > output &&
test $(grep -c "^tag " output) = 3

'

test_done

Loading…
Cancel
Save