Merge branch 'maint'

* maint:
  config: add test cases for empty value and no value config variables.
  cvsimport: have default merge regex also match beginning of commit message
  git clone -s documentation: force a new paragraph for the NOTE
  status: suggest "git rm --cached" to unstage for initial commit
  Protect get_author_ident_from_commit() from filenames in work tree
  upload-pack: Initialize the exec-path.
  bisect: use verbatim commit subject in the bisect log
  git-cvsimport.txt: fix '-M' description.
  Revert "pack-objects: only throw away data during memory pressure"
This commit is contained in:
Junio C Hamano 2008-02-13 14:33:19 -08:00
commit aa8d53ec38
10 changed files with 50 additions and 24 deletions

View file

@ -62,12 +62,13 @@ OPTIONS
.git/objects/info/alternates to share the objects .git/objects/info/alternates to share the objects
with the source repository. The resulting repository with the source repository. The resulting repository
starts out without any object of its own. starts out without any object of its own.
*NOTE*: this is a possibly dangerous operation; do *not* use +
it unless you understand what it does. If you clone your *NOTE*: this is a possibly dangerous operation; do *not* use
repository using this option, then delete branches in the it unless you understand what it does. If you clone your
source repository and then run linkgit:git-gc[1] using the repository using this option, then delete branches in the
'--prune' option in the source repository, it may remove source repository and then run linkgit:git-gc[1] using the
objects which are referenced by the cloned repository. '--prune' option in the source repository, it may remove
objects which are referenced by the cloned repository.

View file

@ -107,8 +107,8 @@ If you need to pass multiple options, separate them with a comma.
-M <regex>:: -M <regex>::
Attempt to detect merges based on the commit message with a custom Attempt to detect merges based on the commit message with a custom
regex. It can be used with '-m' to also see the default regexes. regex. It can be used with '-m' to enable the default regexes
You must escape forward slashes. as well. You must escape forward slashes.
-S <regex>:: -S <regex>::
Skip paths matching the regex. Skip paths matching the regex.

View file

@ -1464,7 +1464,7 @@ static unsigned int check_delta_limit(struct object_entry *me, unsigned int n)
return m; return m;
} }
static unsigned long free_unpacked_data(struct unpacked *n) static unsigned long free_unpacked(struct unpacked *n)
{ {
unsigned long freed_mem = sizeof_delta_index(n->index); unsigned long freed_mem = sizeof_delta_index(n->index);
free_delta_index(n->index); free_delta_index(n->index);
@ -1474,12 +1474,6 @@ static unsigned long free_unpacked_data(struct unpacked *n)
free(n->data); free(n->data);
n->data = NULL; n->data = NULL;
} }
return freed_mem;
}
static unsigned long free_unpacked(struct unpacked *n)
{
unsigned long freed_mem = free_unpacked_data(n);
n->entry = NULL; n->entry = NULL;
n->depth = 0; n->depth = 0;
return freed_mem; return freed_mem;
@ -1520,7 +1514,7 @@ static void find_deltas(struct object_entry **list, unsigned *list_size,
mem_usage > window_memory_limit && mem_usage > window_memory_limit &&
count > 1) { count > 1) {
uint32_t tail = (idx + window - count) % window; uint32_t tail = (idx + window - count) % window;
mem_usage -= free_unpacked_data(array + tail); mem_usage -= free_unpacked(array + tail);
count--; count--;
} }
@ -1553,9 +1547,6 @@ static void find_deltas(struct object_entry **list, unsigned *list_size,
if (!m->entry) if (!m->entry)
break; break;
ret = try_delta(n, m, max_depth, &mem_usage); ret = try_delta(n, m, max_depth, &mem_usage);
if (window_memory_limit &&
mem_usage > window_memory_limit)
mem_usage -= free_unpacked_data(m);
if (ret < 0) if (ret < 0)
break; break;
else if (ret > 0) else if (ret > 0)

View file

@ -135,7 +135,7 @@ bisect_write() {
*) die "Bad bisect_write argument: $state" ;; *) die "Bad bisect_write argument: $state" ;;
esac esac
git update-ref "refs/bisect/$tag" "$rev" git update-ref "refs/bisect/$tag" "$rev"
echo "# $state: "$(git show-branch $rev) >>"$GIT_DIR/BISECT_LOG" echo "# $state: $(git show-branch $rev)" >>"$GIT_DIR/BISECT_LOG"
test -z "$nolog" && echo "git-bisect $state $rev" >>"$GIT_DIR/BISECT_LOG" test -z "$nolog" && echo "git-bisect $state $rev" >>"$GIT_DIR/BISECT_LOG"
} }

View file

@ -164,7 +164,7 @@ sub read_repo_config {
our @mergerx = (); our @mergerx = ();
if ($opt_m) { if ($opt_m) {
@mergerx = ( qr/\W(?:from|of|merge|merging|merged) (\w+)/i ); @mergerx = ( qr/\b(?:from|of|merge|merging|merged) (\w+)/i );
} }
if ($opt_M) { if ($opt_M) {
push (@mergerx, qr/$opt_M/); push (@mergerx, qr/$opt_M/);

View file

@ -119,7 +119,7 @@ get_author_ident_from_commit () {
} }
' '
encoding=$(git config i18n.commitencoding || echo UTF-8) encoding=$(git config i18n.commitencoding || echo UTF-8)
git show -s --pretty=raw --encoding="$encoding" "$1" | git show -s --pretty=raw --encoding="$encoding" "$1" -- |
LANG=C LC_ALL=C sed -ne "$pick_author_script" LANG=C LC_ALL=C sed -ne "$pick_author_script"
} }

View file

@ -340,4 +340,26 @@ test_expect_success 'rebase a commit violating pre-commit' '
' '
test_expect_success 'rebase with a file named HEAD in worktree' '
rm -fr .git/hooks &&
git reset --hard &&
git checkout -b branch3 A &&
(
GIT_AUTHOR_NAME="Squashed Away" &&
export GIT_AUTHOR_NAME &&
>HEAD &&
git add HEAD &&
git commit -m "Add head" &&
>BODY &&
git add BODY &&
git commit -m "Add body"
) &&
FAKE_LINES="1 squash 2" git rebase -i to-be-rebased &&
test "$(git show -s --pretty=format:%an)" = "Squashed Away"
'
test_done test_done

View file

@ -17,6 +17,9 @@ test_expect_success 'setup' '
: > dir1/tracked && : > dir1/tracked &&
: > dir1/modified && : > dir1/modified &&
git add . && git add . &&
git status >output &&
test_tick && test_tick &&
git commit -m initial && git commit -m initial &&
: > untracked && : > untracked &&
@ -28,6 +31,12 @@ test_expect_success 'setup' '
git add dir2/added git add dir2/added
' '
test_expect_success 'status (1)' '
grep -e "use \"git rm --cached <file>\.\.\.\" to unstage" output
'
cat > expect << \EOF cat > expect << \EOF
# On branch master # On branch master
# Changes to be committed: # Changes to be committed:
@ -51,7 +60,7 @@ cat > expect << \EOF
# untracked # untracked
EOF EOF
test_expect_success 'status' ' test_expect_success 'status (2)' '
git status > output && git status > output &&
git diff expect output git diff expect output

View file

@ -620,6 +620,9 @@ int main(int argc, char **argv)
if (i != argc-1) if (i != argc-1)
usage(upload_pack_usage); usage(upload_pack_usage);
setup_path(NULL);
dir = argv[i]; dir = argv[i];
if (!enter_repo(dir, strict)) if (!enter_repo(dir, strict))

View file

@ -60,7 +60,7 @@ static void wt_status_print_cached_header(struct wt_status *s)
{ {
const char *c = color(WT_STATUS_HEADER); const char *c = color(WT_STATUS_HEADER);
color_fprintf_ln(s->fp, c, "# Changes to be committed:"); color_fprintf_ln(s->fp, c, "# Changes to be committed:");
if (s->reference) { if (!s->is_initial) {
color_fprintf_ln(s->fp, c, "# (use \"git reset %s <file>...\" to unstage)", s->reference); color_fprintf_ln(s->fp, c, "# (use \"git reset %s <file>...\" to unstage)", s->reference);
} else { } else {
color_fprintf_ln(s->fp, c, "# (use \"git rm --cached <file>...\" to unstage)"); color_fprintf_ln(s->fp, c, "# (use \"git rm --cached <file>...\" to unstage)");