From e18ee576b1420e7b2cfc5c686872fa3b439ac45f Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Mon, 30 Apr 2007 21:37:57 +0300 Subject: SPECIFYING RANGES typo fix: it it => it is Signed-off-by: Jari Aalto Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index a8bf6561e1..7757abe621 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -255,7 +255,7 @@ reachable from `r1` from the set of commits reachable from A similar notation "`r1\...r2`" is called symmetric difference of `r1` and `r2` and is defined as "`r1 r2 --not $(git-merge-base --all r1 r2)`". -It it the set of commits that are reachable from either one of +It is the set of commits that are reachable from either one of `r1` or `r2` but not from both. Two other shorthands for naming a set that is formed by a commit -- cgit v1.2.3 From 4faac2468de86f4dfd482d55d7c9adc7f2796f07 Mon Sep 17 00:00:00 2001 From: Matthias Lederhofer Date: Sun, 3 Jun 2007 16:46:04 +0200 Subject: rev-parse: document --is-inside-git-dir Signed-off-by: Matthias Lederhofer Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 7757abe621..5fcec19a56 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -89,6 +89,10 @@ OPTIONS --git-dir:: Show `$GIT_DIR` if defined else show the path to the .git directory. +--is-inside-git-dir:: + When the current working directory is below the repository + directory print "true", otherwise "false". + --short, --short=number:: Instead of outputting the full SHA1 values of object names try to abbreviate them to a shorter unique name. When no length is specified -- cgit v1.2.3 From 493c774e58a05bbbac06e4ae1654ca3d24e4e5cf Mon Sep 17 00:00:00 2001 From: Matthias Lederhofer Date: Sun, 3 Jun 2007 16:46:36 +0200 Subject: rev-parse: introduce --is-bare-repository Signed-off-by: Matthias Lederhofer Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 5fcec19a56..c817d1614a 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -93,6 +93,9 @@ OPTIONS When the current working directory is below the repository directory print "true", otherwise "false". +--is-bare-repository:: + When the repository is bare print "true", otherwise "false". + --short, --short=number:: Instead of outputting the full SHA1 values of object names try to abbreviate them to a shorter unique name. When no length is specified -- cgit v1.2.3 From 892c41b98ae2e6baf3aa13901cb10db9ac67d2f3 Mon Sep 17 00:00:00 2001 From: Matthias Lederhofer Date: Wed, 6 Jun 2007 09:10:42 +0200 Subject: introduce GIT_WORK_TREE to specify the work tree setup_gdg is used as abbreviation for setup_git_directory_gently. The work tree can be specified using the environment variable GIT_WORK_TREE and the config option core.worktree (the environment variable has precendence over the config option). Additionally there is a command line option --work-tree which sets the environment variable. setup_gdg does the following now: GIT_DIR unspecified repository in .git directory parent directory of the .git directory is used as work tree, GIT_WORK_TREE is ignored GIT_DIR unspecified repository in cwd GIT_DIR is set to cwd see the cases with GIT_DIR specified what happens next and also see the note below GIT_DIR specified GIT_WORK_TREE/core.worktree unspecified cwd is used as work tree GIT_DIR specified GIT_WORK_TREE/core.worktree specified the specified work tree is used Note on the case where GIT_DIR is unspecified and repository is in cwd: GIT_WORK_TREE is used but is_inside_git_dir is always true. I did it this way because setup_gdg might be called multiple times (e.g. when doing alias expansion) and in successive calls setup_gdg should do the same thing every time. Meaning of is_bare/is_inside_work_tree/is_inside_git_dir: (1) is_bare_repository A repository is bare if core.bare is true or core.bare is unspecified and the name suggests it is bare (directory not named .git). The bare option disables a few protective checks which are useful with a working tree. Currently this changes if a repository is bare: updates of HEAD are allowed git gc packs the refs the reflog is disabled by default (2) is_inside_work_tree True if the cwd is inside the associated working tree (if there is one), false otherwise. (3) is_inside_git_dir True if the cwd is inside the git directory, false otherwise. Before this patch is_inside_git_dir was always true for bare repositories. When setup_gdg finds a repository git_config(git_default_config) is always called. This ensure that is_bare_repository makes use of core.bare and does not guess even though core.bare is specified. inside_work_tree and inside_git_dir are set if setup_gdg finds a repository. The is_inside_work_tree and is_inside_git_dir functions will die if they are called before a successful call to setup_gdg. Signed-off-by: Matthias Lederhofer Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index c817d1614a..6e4d15829d 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -93,6 +93,10 @@ OPTIONS When the current working directory is below the repository directory print "true", otherwise "false". +--is-inside-work-tree:: + When the current working directory is inside the work tree of the + repository print "true", otherwise "false". + --is-bare-repository:: When the repository is bare print "true", otherwise "false". -- cgit v1.2.3 From a6080a0a44d5ead84db3dabbbc80e82df838533d Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 7 Jun 2007 00:04:01 -0700 Subject: War on whitespace This uses "git-apply --whitespace=strip" to fix whitespace errors that have crept in to our source files over time. There are a few files that need to have trailing whitespaces (most notably, test vectors). The results still passes the test, and build result in Documentation/ area is unchanged. Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 1 - 1 file changed, 1 deletion(-) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 7757abe621..e1cb4ef856 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -286,4 +286,3 @@ Documentation by Junio C Hamano and the git-list . GIT --- Part of the gitlink:git[7] suite - -- cgit v1.2.3 From c9bf7be238ac3c767f9ac6546d5bb7b11765253c Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Sat, 16 Jun 2007 21:03:44 +0200 Subject: Document git rev-parse --is-inside-git-dir Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index e1cb4ef856..87771b832b 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -89,6 +89,10 @@ OPTIONS --git-dir:: Show `$GIT_DIR` if defined else show the path to the .git directory. +--is-inside-git-dir:: + Return "true" if we are in the git directory, otherwise "false". + Some commands require to be run in a working directory. + --short, --short=number:: Instead of outputting the full SHA1 values of object names try to abbreviate them to a shorter unique name. When no length is specified -- cgit v1.2.3 From f1ec6b22a8c1ab1cca0f1875f85aea5d2434e5a6 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 10 Aug 2007 00:49:27 -0700 Subject: Fix an illustration in git-rev-parse.txt This hides the backslash at the end of line from AsciiDoc toolchain by introducing a trailing whitespace on one line in an illustration in git-rev-parse.txt. Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index eea9c9cfe9..4b4d229e60 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -224,7 +224,7 @@ left-to-right. G H I J \ / \ / D E F - \ | / \ + \ | / \ \ | / | \|/ | B C -- cgit v1.2.3 From 257a84d9d02e90447b149af58b271c19405edb6a Mon Sep 17 00:00:00 2001 From: Steven Grimm Date: Mon, 20 Aug 2007 11:36:38 +0800 Subject: Document what the stage numbers in the :$n:path syntax mean. The git-rev-parse manpage talks about the :$n:path notation (buried deep in a list of other syntax) but it just says $n is a "stage number" -- someone who is not familiar with the internals of git's merge implementation is never going to be able to figure out that "1", "2", and "3" means. Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 4b4d229e60..4758c33dee 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -215,7 +215,10 @@ blobs contained in a commit. * A colon, optionally followed by a stage number (0 to 3) and a colon, followed by a path; this names a blob object in the index at the given path. Missing stage number (and the colon - that follows it) names an stage 0 entry. + that follows it) names an stage 0 entry. During a merge, stage + 1 is the common ancestor, stage 2 is the target branch's version + (typically the current branch), and stage 3 is the version from + the branch being merged. Here is an illustration, by Jon Loeliger. Both node B and C are a commit parents of commit node A. Parent commits are ordered -- cgit v1.2.3 From 21d4783538662143ef52ed6967c948ab27586232 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Sun, 4 Nov 2007 11:30:53 +0100 Subject: Add a parseopt mode to git-rev-parse to bring parse-options to shell scripts. Signed-off-by: Pierre Habouzit Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 76 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 74 insertions(+), 2 deletions(-) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 4758c33dee..329fce0aab 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -23,6 +23,13 @@ distinguish between them. OPTIONS ------- +--parseopt:: + Use `git-rev-parse` in option parsing mode (see PARSEOPT section below). + +--keep-dash-dash:: + Only meaningful in `--parseopt` mode. Tells the option parser to echo + out the first `--` met instead of skipping it. + --revs-only:: Do not output flags and parameters not meant for `git-rev-list` command. @@ -288,10 +295,75 @@ Here are a handful examples: C^@ I J F F^! D G H D F +PARSEOPT +-------- + +In `--parseopt` mode, `git-rev-parse` helps massaging options to bring to shell +scripts the same facilities C builtins have. It works as an option normalizer +(e.g. splits single switches aggregate values), a bit like `getopt(1)` does. + +It takes on the standard input the specification of the options to parse and +understand, and echoes on the standard output a line suitable for `sh(1)` `eval` +to replace the arguments with normalized ones. In case of error, it outputs +usage on the standard error stream, and exits with code 129. + +Input Format +~~~~~~~~~~~~ + +`git-rev-parse --parseopt` input format is fully text based. It has two parts, +separated by a line that contains only `--`. The lines before the separator +(should be more than one) are used for the usage. +The lines after the separator describe the options. + +Each line of options has this format: + +------------ +? SP+ help LF +------------ + +``:: + its format is the short option character, then the long option name + separated by a comma. Both parts are not required, though at least one + is necessary. `h,help`, `dry-run` and `f` are all three correct + ``. + +``:: + an `` tells the option parser if the option has an argument + (`=`), an optional one (`?` though its use is discouraged) or none + (no `` in that case). + +The remainder of the line, after stripping the spaces, is used +as the help associated to the option. + +Blank lines are ignored, and lines that don't match this specification are used +as option group headers (start the line with a space to create such +lines on purpose). + +Example +~~~~~~~ + +------------ +OPTS_SPEC="\ +some-command [options] ... + +some-command does foo and bar! +-- +h,help show the help + +foo some nifty option --foo +bar= some cool option --bar with an argument + + An option group Header +C? option C with an optional argument" + +eval `echo "$OPTS_SPEC" | git-rev-parse --parseopt -- "$@" || echo exit $?` +------------ + + Author ------ -Written by Linus Torvalds and -Junio C Hamano +Written by Linus Torvalds . +Junio C Hamano and Pierre Habouzit Documentation -------------- -- cgit v1.2.3 From a6d97d49e23382027efff8a8e90e69e0572620c6 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 5 Jan 2008 12:09:55 -0800 Subject: git-rev-parse --symbolic-full-name The plumbing level can understand that the user meant "refs/heads/master" when the user says "master" or "heads/master", but there is no easy way for the scripts to figure it out without duplicating the dwim_ref() logic. Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 329fce0aab..0cedc13728 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -70,6 +70,13 @@ OPTIONS possible '{caret}' prefix); this option makes them output in a form as close to the original input as possible. +--symbolic-full-name:: + This is similar to \--symbolic, but it omits input that + are not refs (i.e. branch or tag names; or more + explicitly disambiguating "heads/master" form, when you + want to name the "master" branch when there is an + unfortunately named tag "master"), and show them as full + refnames (e.g. "refs/heads/master"). --all:: Show all refs found in `$GIT_DIR/refs`. -- cgit v1.2.3 From 5162e69732d13dd079919a389a6ace8878aad716 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 29 Dec 2007 00:20:38 -0600 Subject: Documentation: rename gitlink macro to linkgit Between AsciiDoc 8.2.2 and 8.2.3, the following change was made to the stock Asciidoc configuration: @@ -149,7 +153,10 @@ # Inline macros. # Backslash prefix required for escape processing. # (?s) re flag for line spanning. -(?su)[\\]?(?P\w(\w|-)*?):(?P\S*?)(\[(?P.*?)\])= + +# Explicit so they can be nested. +(?su)[\\]?(?P(http|https|ftp|file|mailto|callto|image|link)):(?P\S*?)(\[(?P.*?)\])= + # Anchor: [[[id]]]. Bibliographic anchor. (?su)[\\]?\[\[\[(?P[\w][\w-]*?)\]\]\]=anchor3 # Anchor: [[id,xreflabel]] This default regex now matches explicit values, and unfortunately in this case gitlink was being matched by just 'link', causing the wrong inline macro template to be applied. By renaming the macro, we can avoid being matched by the wrong regex. Signed-off-by: Dan McGee Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 0cedc13728..5d9c36985f 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -378,4 +378,4 @@ Documentation by Junio C Hamano and the git-list . GIT --- -Part of the gitlink:git[7] suite +Part of the linkgit:git[7] suite -- cgit v1.2.3 From a5d86f7406ecda78b44faf9ab50b7c6e419dba9d Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 29 Jan 2008 20:38:55 +0100 Subject: fix doc typos Signed-off-by: Jim Meyering Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 5d9c36985f..af988821b8 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -229,13 +229,13 @@ blobs contained in a commit. * A colon, optionally followed by a stage number (0 to 3) and a colon, followed by a path; this names a blob object in the index at the given path. Missing stage number (and the colon - that follows it) names an stage 0 entry. During a merge, stage + that follows it) names a stage 0 entry. During a merge, stage 1 is the common ancestor, stage 2 is the target branch's version (typically the current branch), and stage 3 is the version from the branch being merged. Here is an illustration, by Jon Loeliger. Both node B and C are -a commit parents of commit node A. Parent commits are ordered +commit parents of commit node A. Parent commits are ordered left-to-right. G H I J @@ -291,7 +291,7 @@ and its parent commits exists. `r1{caret}@` notation means all parents of `r1`. `r1{caret}!` includes commit `r1` but excludes its all parents. -Here are a handful examples: +Here are a handful of examples: D G H D D F G H I J D F -- cgit v1.2.3 From da101b82b6f639c9916ee0596c86d29410093ca5 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 31 Jan 2008 20:55:57 +0100 Subject: git rev-parse manpage: spelling fix Signed-off-by: Miklos Vajna Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index af988821b8..f02f6bbb49 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -234,8 +234,8 @@ blobs contained in a commit. (typically the current branch), and stage 3 is the version from the branch being merged. -Here is an illustration, by Jon Loeliger. Both node B and C are -commit parents of commit node A. Parent commits are ordered +Here is an illustration, by Jon Loeliger. Both commit nodes B +and C are parents of commit node A. Parent commits are ordered left-to-right. G H I J -- cgit v1.2.3 From ff962a3f1900966d008d6f9eaf32095c42322b9d Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Sun, 2 Mar 2008 09:21:38 +0100 Subject: parse-opt: bring PARSE_OPT_HIDDEN and NONEG to git-rev-parse --parseopt Signed-off-by: Pierre Habouzit Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index f02f6bbb49..6513c2efe1 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -325,7 +325,7 @@ The lines after the separator describe the options. Each line of options has this format: ------------ -? SP+ help LF +* SP+ help LF ------------ ``:: @@ -334,10 +334,17 @@ Each line of options has this format: is necessary. `h,help`, `dry-run` and `f` are all three correct ``. -``:: - an `` tells the option parser if the option has an argument - (`=`), an optional one (`?` though its use is discouraged) or none - (no `` in that case). +``:: + `` are of `*`, `=`, `?` or `!`. + * Use `=` if the option takes an argument. + + * Use `?` to mean that the option is optional (though its use is discouraged). + + * Use `*` to mean that this option should not be listed in the usage + generated for the `-h` argument. It's shown for `--help-all` as + documented in linkgit:gitcli[5]. + + * Use `!` to not make the corresponding negated long option available. The remainder of the line, after stripping the spaces, is used as the help associated to the option. -- cgit v1.2.3 From b1b359699a24a89f773cccdf35801bc6fc15ade8 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Sat, 26 Apr 2008 13:57:23 +0200 Subject: rev-parse: teach "--verify" to be quiet when using "-q" or "--quiet" Currently "git rev-parse --verify " is often used with its error output redirected to /dev/null. This patch makes it easier to do that. The -q|--quiet option is designed to work the same way as it does for "git symbolic-ref". Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 6513c2efe1..110e7ba71f 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -52,6 +52,11 @@ OPTIONS The parameter given must be usable as a single, valid object name. Otherwise barf and abort. +-q, --quiet:: + Only meaningful in `--verify` mode. Do not output an error + message if the first argument is not a valid object name; + instead exit with non-zero status silently. + --sq:: Usually the output is made one line per flag and parameter. This option makes output a single line, -- cgit v1.2.3 From a5af0e2c550e68b15a38f02ae1d3c3416f8cf276 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Fri, 2 May 2008 05:30:47 +0200 Subject: Documentation: rename "hooks.txt" to "githooks.txt" and make it a man page Also now "gitcli(5)" becomes "gitcli(7)". Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 110e7ba71f..b6b2fe92a1 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -347,7 +347,7 @@ Each line of options has this format: * Use `*` to mean that this option should not be listed in the usage generated for the `-h` argument. It's shown for `--help-all` as - documented in linkgit:gitcli[5]. + documented in linkgit:gitcli[7]. * Use `!` to not make the corresponding negated long option available. -- cgit v1.2.3 From 824b5dc29cfe4f58d052d2d9273b39d34bf018e0 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Tue, 13 May 2008 06:51:41 +0200 Subject: Documentation: rev-parse: add a few "--verify" and "--default" examples Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index b6b2fe92a1..69599ffb67 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -378,6 +378,31 @@ C? option C with an optional argument" eval `echo "$OPTS_SPEC" | git-rev-parse --parseopt -- "$@" || echo exit $?` ------------ +EXAMPLES +-------- + +* Print the object name of the current commit: ++ +------------ +$ git rev-parse --verify HEAD +------------ + +* Print the commit object name from the revision in the $REV shell variable: ++ +------------ +$ git rev-parse --verify $REV +------------ ++ +This will error out if $REV is empty or not a valid revision. + +* Same as above: ++ +------------ +$ git rev-parse --default master --verify $REV +------------ ++ +but if $REV is empty, the commit object name from master will be printed. + Author ------ -- cgit v1.2.3 From df2740b066b2d6649449f2d8efdd0727647ab57c Mon Sep 17 00:00:00 2001 From: Michele Ballabio Date: Mon, 26 May 2008 15:24:02 +0200 Subject: Documentation: fix graph in git-rev-parse.txt Preformatted html and man pages show a mangled graph, caused by a backslash. Commit f1ec6b22a8c1ab1cca0f1875f85aea5d2434e5a6 fixed this same issue, but it seems that new versions of the Asciidoc toolchain changed their behaviour. Signed-off-by: Michele Ballabio Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 6513c2efe1..5981c79f6a 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -238,16 +238,18 @@ Here is an illustration, by Jon Loeliger. Both commit nodes B and C are parents of commit node A. Parent commits are ordered left-to-right. - G H I J - \ / \ / - D E F - \ | / \ - \ | / | - \|/ | - B C - \ / - \ / - A +........................................ +G H I J + \ / \ / + D E F + \ | / \ + \ | / | + \|/ | + B C + \ / + \ / + A +........................................ A = = A^0 B = A^ = A^1 = A~1 -- cgit v1.2.3 From 9e1f0a85c68323830ea117092c55192b17aa3ac8 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Fri, 6 Jun 2008 09:07:32 +0200 Subject: documentation: move git(7) to git(1) As the "git" man page describes the "git" command at the end-user level, it seems better to move it to man section 1. Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 5641d99518..a0ef1fd550 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -417,4 +417,4 @@ Documentation by Junio C Hamano and the git-list . GIT --- -Part of the linkgit:git[7] suite +Part of the linkgit:git[1] suite -- cgit v1.2.3 From 3240240ff427fa2e26a847c7c9fd89e6a4313daa Mon Sep 17 00:00:00 2001 From: Stephan Beyer Date: Sun, 8 Jun 2008 03:36:09 +0200 Subject: Docs: Use "-l::\n--long\n" format in OPTIONS sections The OPTIONS section of a documentation file contains a list of the options a git command accepts. Currently there are several variants to describe the case that different options (almost) do the same in the OPTIONS section. Some are: -f, --foo:: -f|--foo:: -f | --foo:: But AsciiDoc has the special form: -f:: --foo:: This patch applies this form to the documentation of the whole git suite, and removes useless em-dash prevention, so \--foo becomes --foo. Signed-off-by: Stephan Beyer Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index a0ef1fd550..9e273bc5a6 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -52,7 +52,8 @@ OPTIONS The parameter given must be usable as a single, valid object name. Otherwise barf and abort. --q, --quiet:: +-q:: +--quiet:: Only meaningful in `--verify` mode. Do not output an error message if the first argument is not a valid object name; instead exit with non-zero status silently. @@ -119,16 +120,19 @@ OPTIONS --is-bare-repository:: When the repository is bare print "true", otherwise "false". ---short, --short=number:: +--short:: +--short=number:: Instead of outputting the full SHA1 values of object names try to abbreviate them to a shorter unique name. When no length is specified 7 is used. The minimum length is 4. ---since=datestring, --after=datestring:: +--since=datestring:: +--after=datestring:: Parses the date string, and outputs corresponding --max-age= parameter for git-rev-list command. ---until=datestring, --before=datestring:: +--until=datestring:: +--before=datestring:: Parses the date string, and outputs corresponding --min-age= parameter for git-rev-list command. -- cgit v1.2.3 From a0d2ceb2769731571cdd195582bfedf90225e712 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Sun, 29 Jun 2008 23:27:45 -0400 Subject: doc/rev-parse: clarify reflog vs --until for specifying revisions The rev-parse manpage introduces the branch@{date} syntax, and mentions the reflog specifically. However, new users may not be familiar with the distinction between the reflog and the commit date, so let's help them out with a "you may be interested in --until" pointer. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 9e273bc5a6..59e95adf42 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -184,7 +184,10 @@ blobs contained in a commit. second ago\}' or '\{1979-02-26 18:30:00\}') to specify the value of the ref at a prior point in time. This suffix may only be used immediately following a ref name and the ref must have an - existing log ($GIT_DIR/logs/). + existing log ($GIT_DIR/logs/). Note that this looks up the state + of your *local* ref at a given time; e.g., what was in your local + `master` branch last week. If you want to look at commits made during + certain times, see `--since` and `--until`. * A ref followed by the suffix '@' with an ordinal specification enclosed in a brace pair (e.g. '\{1\}', '\{15\}') to specify -- cgit v1.2.3 From b1889c36d85514e5e70462294c561a02c2edfe2b Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Mon, 30 Jun 2008 01:09:04 -0500 Subject: Documentation: be consistent about "git-" versus "git " Since the git-* commands are not installed in $(bindir), using "git-command " in examples in the documentation is not a good idea. On the other hand, it is nice to be able to refer to each command using one hyphenated word. (There is no escaping it, anyway: man page names cannot have spaces in them.) This patch retains the dash in naming an operation, command, program, process, or action. Complete command lines that can be entered at a shell (i.e., without options omitted) are made to use the dashless form. The changes consist only of replacing some spaces with hyphens and vice versa. After a "s/ /-/g", the unpatched and patched versions are identical. Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 59e95adf42..e9fb2b1579 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -8,7 +8,7 @@ git-rev-parse - Pick out and massage parameters SYNOPSIS -------- -'git-rev-parse' [ --option ] ... +'git rev-parse' [ --option ] ... DESCRIPTION ----------- @@ -296,7 +296,7 @@ reachable from `r1` from the set of commits reachable from A similar notation "`r1\...r2`" is called symmetric difference of `r1` and `r2` and is defined as -"`r1 r2 --not $(git-merge-base --all r1 r2)`". +"`r1 r2 --not $(git merge-base --all r1 r2)`". It is the set of commits that are reachable from either one of `r1` or `r2` but not from both. @@ -384,7 +384,7 @@ bar= some cool option --bar with an argument An option group Header C? option C with an optional argument" -eval `echo "$OPTS_SPEC" | git-rev-parse --parseopt -- "$@" || echo exit $?` +eval `echo "$OPTS_SPEC" | git rev-parse --parseopt -- "$@" || echo exit $?` ------------ EXAMPLES -- cgit v1.2.3 From 483bc4f045881b998512ae814d6cf44d0c0cb493 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Mon, 30 Jun 2008 13:56:34 -0500 Subject: Documentation formatting and cleanup Following what appears to be the predominant style, format names of commands and commandlines both as `teletype text`. While we're at it, add articles ("a" and "the") in some places, italicize the name of the command in the manual page synopsis line, and add a comma or two where it seems appropriate. Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index e9fb2b1579..6825ae27c4 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -15,8 +15,8 @@ DESCRIPTION Many git porcelainish commands take mixture of flags (i.e. parameters that begin with a dash '-') and parameters -meant for underlying `git-rev-list` command they use internally -and flags and parameters for other commands they use as the +meant for the underlying `git-rev-list` command they use internally +and flags and parameters for the other commands they use downstream of `git-rev-list`. This command is used to distinguish between them. @@ -128,13 +128,13 @@ OPTIONS --since=datestring:: --after=datestring:: - Parses the date string, and outputs corresponding - --max-age= parameter for git-rev-list command. + Parse the date string, and output the corresponding + --max-age= parameter for `git-rev-list`. --until=datestring:: --before=datestring:: - Parses the date string, and outputs corresponding - --min-age= parameter for git-rev-list command. + Parse the date string, and output the corresponding + --min-age= parameter for `git-rev-list`. ...:: Flags and parameters to be parsed. -- cgit v1.2.3 From ba020ef5eb5fca3d757bd580ff117adaf81ca079 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Thu, 3 Jul 2008 00:41:41 -0500 Subject: manpages: italicize git command names (which were in teletype font) The names of git commands are not meant to be entered at the commandline; they are just names. So we render them in italics, as is usual for command names in manpages. Using doit () { perl -e 'for (<>) { s/\`(git-[^\`.]*)\`/'\''\1'\''/g; print }' } for i in git*.txt config.txt diff*.txt blame*.txt fetch*.txt i18n.txt \ merge*.txt pretty*.txt pull*.txt rev*.txt urls*.txt do doit <"$i" >"$i+" && mv "$i+" "$i" done git diff . Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 6825ae27c4..0501a87025 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -15,16 +15,16 @@ DESCRIPTION Many git porcelainish commands take mixture of flags (i.e. parameters that begin with a dash '-') and parameters -meant for the underlying `git-rev-list` command they use internally +meant for the underlying 'git-rev-list' command they use internally and flags and parameters for the other commands they use -downstream of `git-rev-list`. This command is used to +downstream of 'git-rev-list'. This command is used to distinguish between them. OPTIONS ------- --parseopt:: - Use `git-rev-parse` in option parsing mode (see PARSEOPT section below). + Use 'git-rev-parse' in option parsing mode (see PARSEOPT section below). --keep-dash-dash:: Only meaningful in `--parseopt` mode. Tells the option parser to echo @@ -32,11 +32,11 @@ OPTIONS --revs-only:: Do not output flags and parameters not meant for - `git-rev-list` command. + 'git-rev-list' command. --no-revs:: Do not output flags and parameters meant for - `git-rev-list` command. + 'git-rev-list' command. --flags:: Do not output non-flag parameters. @@ -64,7 +64,7 @@ OPTIONS properly quoted for consumption by shell. Useful when you expect your parameter to contain whitespaces and newlines (e.g. when using pickaxe `-S` with - `git-diff-\*`). + 'git-diff-\*'). --not:: When showing object names, prefix them with '{caret}' and @@ -129,12 +129,12 @@ OPTIONS --since=datestring:: --after=datestring:: Parse the date string, and output the corresponding - --max-age= parameter for `git-rev-list`. + --max-age= parameter for 'git-rev-list'. --until=datestring:: --before=datestring:: Parse the date string, and output the corresponding - --min-age= parameter for `git-rev-list`. + --min-age= parameter for 'git-rev-list'. ...:: Flags and parameters to be parsed. @@ -155,7 +155,7 @@ blobs contained in a commit. name the same commit object if there are no other object in your repository whose object name starts with dae86e. -* An output from `git-describe`; i.e. a closest tag, followed by a +* An output from 'git-describe'; i.e. a closest tag, followed by a dash, a `g`, and an abbreviated object name. * A symbolic ref name. E.g. 'master' typically means the commit @@ -278,7 +278,7 @@ G H I J SPECIFYING RANGES ----------------- -History traversing commands such as `git-log` operate on a set +History traversing commands such as 'git-log' operate on a set of commits, not just a single commit. To these commands, specifying a single revision with the notation described in the previous section means the set of commits reachable from that @@ -319,7 +319,7 @@ Here are a handful of examples: PARSEOPT -------- -In `--parseopt` mode, `git-rev-parse` helps massaging options to bring to shell +In `--parseopt` mode, 'git-rev-parse' helps massaging options to bring to shell scripts the same facilities C builtins have. It works as an option normalizer (e.g. splits single switches aggregate values), a bit like `getopt(1)` does. @@ -331,7 +331,7 @@ usage on the standard error stream, and exits with code 129. Input Format ~~~~~~~~~~~~ -`git-rev-parse --parseopt` input format is fully text based. It has two parts, +'git-rev-parse --parseopt' input format is fully text based. It has two parts, separated by a line that contains only `--`. The lines before the separator (should be more than one) are used for the usage. The lines after the separator describe the options. -- cgit v1.2.3 From faf466ffb1b81a6af3946645865b3a38f33cdc11 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Sun, 6 Jul 2008 22:34:21 +0200 Subject: Fix grammar in git-rev-parse(1). Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 59e95adf42..ba65bfa16b 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -301,9 +301,9 @@ It is the set of commits that are reachable from either one of `r1` or `r2` but not from both. Two other shorthands for naming a set that is formed by a commit -and its parent commits exists. `r1{caret}@` notation means all +and its parent commits exist. The `r1{caret}@` notation means all parents of `r1`. `r1{caret}!` includes commit `r1` but excludes -its all parents. +all of its parents. Here are a handful of examples: -- cgit v1.2.3 From fd11ae0b52b6d059056a32851a916c152befae1a Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 7 Jul 2008 14:58:58 -0700 Subject: Documentation: update sections on naming revisions and revision ranges Various *_HEAD pseudo refs were not documented in any central place. Especially since we may be teaching rebase and am to record ORIG_HEAD, it would be a good time to do so. While at it, reword the explanation on r1..r2 notation to reduce confusion. Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 378a3124ac..088f971b79 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -166,7 +166,7 @@ blobs contained in a commit. first match in the following rules: . if `$GIT_DIR/` exists, that is what you mean (this is usually - useful only for `HEAD`, `FETCH_HEAD` and `MERGE_HEAD`); + useful only for `HEAD`, `FETCH_HEAD`, `ORIG_HEAD` and `MERGE_HEAD`); . otherwise, `$GIT_DIR/refs/` if exists; @@ -177,6 +177,16 @@ blobs contained in a commit. . otherwise, `$GIT_DIR/refs/remotes/` if exists; . otherwise, `$GIT_DIR/refs/remotes//HEAD` if exists. ++ +HEAD names the commit your changes in the working tree is based on. +FETCH_HEAD records the branch you fetched from a remote repository +with your last 'git-fetch' invocation. +ORIG_HEAD is created by commands that moves your HEAD in a drastic +way, to record the position of the HEAD before their operation, so that +you can change the tip of the branch back to the state before you ran +them easily. +MERGE_HEAD records the commit(s) you are merging into your branch +when you run 'git-merge'. * A ref followed by the suffix '@' with a date specification enclosed in a brace @@ -289,10 +299,10 @@ notation is used. E.g. "`{caret}r1 r2`" means commits reachable from `r2` but exclude the ones reachable from `r1`. This set operation appears so often that there is a shorthand -for it. "`r1..r2`" is equivalent to "`{caret}r1 r2`". It is -the difference of two sets (subtract the set of commits -reachable from `r1` from the set of commits reachable from -`r2`). +for it. When you have two commits `r1` and `r2` (named according +to the syntax explained in SPECIFYING REVISIONS above), you can ask +for commits that are reachable from r2 excluding those that are reachable +from r1 by "`{caret}r1 r2`" and it can be written as "`r1..r2`". A similar notation "`r1\...r2`" is called symmetric difference of `r1` and `r2` and is defined as -- cgit v1.2.3 From 59eb68aa2b4e52aa1d098e0d76c5130864ceff2e Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 21 Jul 2008 12:14:42 -0700 Subject: Update my e-mail address The old cox.net address is still getting mails from gitters. Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 088f971b79..5c936693d3 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -426,7 +426,7 @@ but if $REV is empty, the commit object name from master will be printed. Author ------ Written by Linus Torvalds . -Junio C Hamano and Pierre Habouzit +Junio C Hamano and Pierre Habouzit Documentation -------------- -- cgit v1.2.3 From 81b237d5db946b4196225712a37639952787c959 Mon Sep 17 00:00:00 2001 From: Cesar Eduardo Barros Date: Sat, 26 Jul 2008 21:46:00 -0300 Subject: Documentation/git-rev-parse.txt: update for new git-describe output format Signed-off-by: Cesar Eduardo Barros Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 5c936693d3..2921da320d 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -155,8 +155,9 @@ blobs contained in a commit. name the same commit object if there are no other object in your repository whose object name starts with dae86e. -* An output from 'git-describe'; i.e. a closest tag, followed by a - dash, a `g`, and an abbreviated object name. +* An output from 'git-describe'; i.e. a closest tag, optionally + followed by a dash and a number of commits, followed by a dash, a + `g`, and an abbreviated object name. * A symbolic ref name. E.g. 'master' typically means the commit object referenced by $GIT_DIR/refs/heads/master. If you -- cgit v1.2.3 From d18ba22154574390dbff2c060f44b9715477e95a Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Sat, 17 Jan 2009 17:09:55 +0100 Subject: sha1_name: support @{-N} syntax in get_sha1() Let get_sha1() parse the @{-N} syntax, with docs and tests. Note that while @{-1}^2, @{-2}~5 and such are supported, @{-1}@{1} is currently not allowed. Signed-off-by: Thomas Rast Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 2921da320d..3ccef2f2b3 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -212,6 +212,9 @@ when you run 'git-merge'. reflog of the current branch. For example, if you are on the branch 'blabla', then '@\{1\}' means the same as 'blabla@\{1\}'. +* The special construct '@\{-\}' means the th branch checked out + before the current one. + * A suffix '{caret}' to a revision parameter means the first parent of that commit object. '{caret}' means the th parent (i.e. 'rev{caret}' -- cgit v1.2.3 From dcb11263bcdbf31955dd00777392249bf1624226 Mon Sep 17 00:00:00 2001 From: Chris Johnsen Date: Sun, 15 Mar 2009 06:30:52 -0500 Subject: Documentation: remove extra quoting/emphasis around literal texts If literal text (asciidoc `...`) can be rendered in a differently from normal text for each output format (man, HTML), then we do not need extra quotes or other wrapping around inline literal text segments. config.txt Change '`...`' to `...`. In asciidoc, the single quotes provide emphasis, literal text should be distintive enough. Change "`...`" to `...`. These double quotes do not work if present in the described config value, so drop them. git-checkout.txt Change "`...`" to `...` or `"..."`. All instances are command line argument examples. One "`-`" becomes `-`. Two others are involve curly braces, so move the double quotes inside the literal region to indicate that they might need to be quoted on the command line of certain shells (tcsh). git-merge.txt Change "`...`" to `...`. All instances are used to describe merge conflict markers. The quotes should are not important. git-rev-parse.txt Change "`...`" to `...`. All instances are around command line arguments where no in-shell quoting should be necessary. gitcli.txt Change `"..."` to `...`. All instances are around command line examples or single command arguments. They do not semanticly belong inside the literal text, and they are not needed outside it. glossary-content.txt user-manual.txt Change "`...`" to `...`. All instances were around command lines. Signed-off-by: Chris Johnsen Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 3ccef2f2b3..5ed2bc840f 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -299,18 +299,18 @@ previous section means the set of commits reachable from that commit, following the commit ancestry chain. To exclude commits reachable from a commit, a prefix `{caret}` -notation is used. E.g. "`{caret}r1 r2`" means commits reachable +notation is used. E.g. `{caret}r1 r2` means commits reachable from `r2` but exclude the ones reachable from `r1`. This set operation appears so often that there is a shorthand for it. When you have two commits `r1` and `r2` (named according to the syntax explained in SPECIFYING REVISIONS above), you can ask for commits that are reachable from r2 excluding those that are reachable -from r1 by "`{caret}r1 r2`" and it can be written as "`r1..r2`". +from r1 by `{caret}r1 r2` and it can be written as `r1..r2`. -A similar notation "`r1\...r2`" is called symmetric difference +A similar notation `r1\...r2` is called symmetric difference of `r1` and `r2` and is defined as -"`r1 r2 --not $(git merge-base --all r1 r2)`". +`r1 r2 --not $(git merge-base --all r1 r2)`. It is the set of commits that are reachable from either one of `r1` or `r2` but not from both. -- cgit v1.2.3 From a45d34691ea624e93863e95706eeb1b1909304f3 Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Mon, 13 Apr 2009 13:20:26 +0200 Subject: rev-parse: --abbrev-ref option to shorten ref name This applies the shorten_unambiguous_ref function to the object name. Default mode is controlled by core.warnAmbiguousRefs. Else it is given as optional argument to --abbrev-ref={strict|loose}. This should be faster than 'git for-each-ref --format="%(refname:short)" ' for single refs. Signed-off-by: Bert Wesarg Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 5ed2bc840f..fba30b12ed 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -84,6 +84,11 @@ OPTIONS unfortunately named tag "master"), and show them as full refnames (e.g. "refs/heads/master"). +--abbrev-ref[={strict|loose}]:: + A non-ambiguous short name of the objects name. + The option core.warnAmbiguousRefs is used to select the strict + abbreviation mode. + --all:: Show all refs found in `$GIT_DIR/refs`. -- cgit v1.2.3 From 2163e3f7786f56d5aaf9eadea6776bb0e38b30a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Tue, 28 Apr 2009 22:29:24 +0200 Subject: parseopt: fix documentation for --keep-dashdash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Uwe Kleine-König Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index fba30b12ed..52c353e674 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -26,7 +26,7 @@ OPTIONS --parseopt:: Use 'git-rev-parse' in option parsing mode (see PARSEOPT section below). ---keep-dash-dash:: +--keep-dashdash:: Only meaningful in `--parseopt` mode. Tells the option parser to echo out the first `--` met instead of skipping it. -- cgit v1.2.3 From 503253771e93fd9f29c9f0773223d456677452c4 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Sat, 25 Apr 2009 06:55:26 +0200 Subject: rev-parse: add --sq-quote to shell quote arguments Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 52c353e674..4bbdd056da 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -30,6 +30,11 @@ OPTIONS Only meaningful in `--parseopt` mode. Tells the option parser to echo out the first `--` met instead of skipping it. +--sq-quote:: + Use 'git-rev-parse' in shell quoting mode (see SQ-QUOTE + section below). In contrast to the `--sq` option below, this + mode does only quoting. Nothing else is done to command input. + --revs-only:: Do not output flags and parameters not meant for 'git-rev-list' command. @@ -64,7 +69,8 @@ OPTIONS properly quoted for consumption by shell. Useful when you expect your parameter to contain whitespaces and newlines (e.g. when using pickaxe `-S` with - 'git-diff-\*'). + 'git-diff-\*'). In contrast to the `--sq-quote` option, + the command input is still interpreted as usual. --not:: When showing object names, prefix them with '{caret}' and @@ -406,6 +412,33 @@ C? option C with an optional argument" eval `echo "$OPTS_SPEC" | git rev-parse --parseopt -- "$@" || echo exit $?` ------------ +SQ-QUOTE +-------- + +In `--sq-quote` mode, 'git-rev-parse' echoes on the standard output a +single line suitable for `sh(1)` `eval`. This line is made by +normalizing the arguments following `--sq-quote`. Nothing other than +quoting the arguments is done. + +If you want command input to still be interpreted as usual by +'git-rev-parse' before the output is shell quoted, see the `--sq` +option. + +Example +~~~~~~~ + +------------ +$ cat >your-git-script.sh <<\EOF +#!/bin/sh +args=$(git rev-parse --sq-quote "$@") # quote user-supplied arguments +command="git frotz -n24 $args" # and use it inside a handcrafted + # command line +eval "$command" +EOF + +$ sh your-git-script.sh "a b'c" +------------ + EXAMPLES -------- -- cgit v1.2.3 From 6e0800ef2575751f2e20d11e2cfe305304e5e9b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Sun, 14 Jun 2009 01:58:43 +0200 Subject: parse-opt: make PARSE_OPT_STOP_AT_NON_OPTION available to git rev-parse MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Uwe Kleine-König Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Documentation/git-rev-parse.txt') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 4bbdd056da..82045a2522 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -30,6 +30,11 @@ OPTIONS Only meaningful in `--parseopt` mode. Tells the option parser to echo out the first `--` met instead of skipping it. +--stop-at-non-option:: + Only meaningful in `--parseopt` mode. Lets the option parser stop at + the first non-option argument. This can be used to parse sub-commands + that take options themself. + --sq-quote:: Use 'git-rev-parse' in shell quoting mode (see SQ-QUOTE section below). In contrast to the `--sq` option below, this -- cgit v1.2.3