From: Junio C Hamano Date: Sun, 7 May 2006 22:36:39 +0000 (-0700) Subject: Merge branch 'fix' X-Git-Tag: v1.4.0-rc1~162 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/fd60acaced6de16ebfb66959067e2b29f99a133e?hp=-c Merge branch 'fix' * fix: repack: honor -d even when no new pack was created clone: keep --reference even with -l -s repo-config: document what value_regexp does a bit more clearly. Release config lock if the regex is invalid core-tutorial.txt: escape asterisk --- fd60acaced6de16ebfb66959067e2b29f99a133e diff --combined Documentation/git-repo-config.txt index fd44f629f5,fccecd6770..660c18ff8d --- a/Documentation/git-repo-config.txt +++ b/Documentation/git-repo-config.txt @@@ -15,7 -15,6 +15,7 @@@ SYNOPSI 'git-repo-config' [type] --get-all name [value_regex] 'git-repo-config' [type] --unset name [value_regex] 'git-repo-config' [type] --unset-all name [value_regex] +'git-repo-config' -l | --list DESCRIPTION ----------- @@@ -23,10 -22,11 +23,11 @@@ You can query/set/replace/unset option actually the section and the key separated by a dot, and the value will be escaped. - If you want to set/unset an option which can occur on multiple lines, you - should provide a POSIX regex for the value. If you want to handle the lines - *not* matching the regex, just prepend a single exclamation mark in front - (see EXAMPLES). + If you want to set/unset an option which can occur on multiple + lines, a POSIX regexp `value_regex` needs to be given. Only the + existing values that match the regexp are updated or unset. If + you want to handle the lines that do *not* match the regex, just + prepend a single exclamation mark in front (see EXAMPLES). The type specifier can be either '--int' or '--bool', which will make 'git-repo-config' ensure that the variable(s) are of the given type and @@@ -34,10 -34,10 +35,10 @@@ convert the value to the canonical for a "true" or "false" string for bool). If no type specifier is passed, no checks or transformations are performed on the value. -This command will fail if +This command will fail if: -. .git/config is invalid, -. .git/config can not be written to, +. The .git/config file is invalid, +. Can not write to .git/config, . no section was provided, . the section or key is invalid, . you try to unset an option which does not exist, or @@@ -49,7 -49,7 +50,7 @@@ OPTION --replace-all:: Default behaviour is to replace at most one line. This replaces - all lines matching the key (and optionally the value_regex) + all lines matching the key (and optionally the value_regex). --get:: Get the value for a given key (optionally filtered by a regex @@@ -59,18 -59,12 +60,18 @@@ Like get, but does not fail if the number of values for the key is not exactly one. +--get-regexp:: + Like --get-all, but interprets the name as a regular expression. + --unset:: Remove the line matching the key from .git/config. --unset-all:: Remove all matching lines from .git/config. +-l, --list:: + List all variables set in .git/config. + EXAMPLE ------- diff --combined config.c index 41066e4f4e,11d65f8c70..61eacefbee --- a/config.c +++ b/config.c @@@ -336,10 -336,8 +336,10 @@@ static int store_aux(const char* key, c store.state = KEY_SEEN; store.seen++; } else if (strrchr(key, '.') - key == store.baselen && - !strncmp(key, store.key, store.baselen)) + !strncmp(key, store.key, store.baselen)) { store.state = SECTION_SEEN; + store.offset[store.seen] = ftell(config_file); + } } return 0; } @@@ -516,6 -514,8 +516,8 @@@ int git_config_set_multivar(const char fprintf(stderr, "Invalid pattern: %s\n", value_regex); free(store.value_regex); + close(fd); + unlink(lock_file); ret = 6; goto out_free; } diff --combined git-repack.sh index e0c9f323c3,20774fbd7e..4fb3f26e83 --- a/git-repack.sh +++ b/git-repack.sh @@@ -5,9 -5,9 +5,9 @@@ USAGE='[-a] [-d] [-f] [-l] [-n] [-q]' . git-sh-setup - + no_update_info= all_into_one= remove_redundant= -local= quiet= no_reuse_delta= +local= quiet= no_reuse_delta= extra= while case "$#" in 0) break ;; esac do case "$1" in @@@ -17,8 -17,6 +17,8 @@@ -q) quiet=-q ;; -f) no_reuse_delta=--no-reuse-delta ;; -l) local=--local ;; + --window=*) extra="$extra $1" ;; + --depth=*) extra="$extra $1" ;; *) usage ;; esac shift @@@ -42,21 -40,21 +42,21 @@@ case ",$all_into_one," i find . -type f \( -name '*.pack' -o -name '*.idx' \) -print` ;; esac -pack_objects="$pack_objects $local $quiet $no_reuse_delta" +pack_objects="$pack_objects $local $quiet $no_reuse_delta$extra" name=$(git-rev-list --objects --all $rev_list 2>&1 | git-pack-objects --non-empty $pack_objects .tmp-pack) || exit 1 if [ -z "$name" ]; then echo Nothing new to pack. - exit 0 - fi - echo "Pack pack-$name created." + else + echo "Pack pack-$name created." - mkdir -p "$PACKDIR" || exit + mkdir -p "$PACKDIR" || exit - mv .tmp-pack-$name.pack "$PACKDIR/pack-$name.pack" && - mv .tmp-pack-$name.idx "$PACKDIR/pack-$name.idx" || - exit + mv .tmp-pack-$name.pack "$PACKDIR/pack-$name.pack" && + mv .tmp-pack-$name.idx "$PACKDIR/pack-$name.idx" || + exit + fi if test "$remove_redundant" = t then