git/contrib
Philippe Blain a50fcc13dd subtree: use 'git rev-parse --verify [--quiet]' for better error messages
There are three occurences of 'git rev-parse <rev>' in 'git-subtree.sh'
where the command expects a revision and the script dies or exits if the
revision can't be found. In that case, the error message from 'git
rev-parse' is:

    $ git rev-parse <bad rev>
    <bad rev>
    fatal: ambiguous argument '<bad rev>': unknown revision or path not in the working tree.
    Use '--' to separate paths from revisions, like this:
    'git <command> [<revision>...] -- [<file>...]'

This is a little confusing to the user, since this error message is
outputed by 'git subtree'.

At these points in the script, we know that we are looking for a single
revision, so be explicit by using '--verify', resulting in a little
better error message:

    $ git rev-parse --verify <bad rev>
    fatal: Needed a single revision

In the two occurences where we 'die' if 'git rev-parse' fails, 'git
subtree' outputs "could not rev-parse split hash $b from commit $sq", so
we actually do not need the supplementary error message from 'git
rev-parse'; add '--quiet' to silence it.

In the third occurence, we 'exit', so keep the error message from 'git
rev-parse'. Note that this messsage is still suboptimal since it can be
understood to mean that 'git rev-parse' did not receive a single
revision as argument, which is not the case here: the command did
receive a single revision, but the revision is not resolvable to an
available object.

The alternative would be to use '--' after the revision, as suggested by
the first error message, resulting in a clearer error message:

    $ git rev-parse <bad rev> --
    fatal: bad revision '<bad rev>'

Unfortunately we can't use that syntax because in the more common case
of the revision resolving to a known object, the command outputs the
object's hash, a newline, and the dashdash, which breaks the 'git
subtree' script.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-10-21 13:51:05 -07:00
..
buildsystems Merge branch 'ed/fsmonitor-on-networked-macos' 2022-10-17 14:56:31 -07:00
coccinelle Merge branch 'rs/cocci-array-copy' 2022-07-19 16:40:18 -07:00
completion git-prompt: show presence of unresolved conflicts at command prompt 2022-08-19 10:58:40 -07:00
contacts git-contacts: also recognise "Reported-by:" 2017-07-27 09:42:55 -07:00
credential osxkeychain: clarify that we ignore unknown lines 2022-09-22 14:21:04 -07:00
diff-highlight diff-highlight: correctly match blank lines for flush 2020-09-21 22:33:28 -07:00
emacs git{,-blame}.el: remove old bitrotting Emacs code 2018-04-16 17:25:49 +09:00
examples Merge branch 'bw/c-plus-plus' into ds/lazy-load-trees 2018-04-11 10:46:32 +09:00
fast-import import-tars: ignore the global PAX header 2020-03-24 14:39:47 -07:00
git-jump git-jump: pass "merge" arguments to ls-files 2021-11-09 11:15:21 -08:00
git-shell-commands
hg-to-git hg-to-git: make it compatible with both python3 and python2 2019-09-18 12:03:05 -07:00
hooks multimail: stop shipping a copy 2021-06-11 13:35:19 +09:00
long-running-filter docs: warn about possible '=' in clean/smudge filter process values 2016-12-06 11:29:52 -08:00
mw-to-git t6000-t9999: detect and signal failure within loop 2021-12-13 10:29:48 -08:00
persistent-https docs/config: mention protocol implications of url.insteadOf 2017-06-01 10:07:10 +09:00
remote-helpers contrib: git-remote-{bzr,hg} placeholders don't need Python 2017-03-03 11:09:34 -08:00
stats contrib: update stats/mailmap script 2012-12-12 11:09:11 -08:00
subtree subtree: use 'git rev-parse --verify [--quiet]' for better error messages 2022-10-21 13:51:05 -07:00
thunderbird-patch-inline contrib/thunderbird-patch-inline/appp.sh: use the $( ... ) construct for command substitution 2015-12-27 15:33:13 -08:00
update-unicode unicode_width.h: rename to use dash in file name 2018-04-11 18:11:00 +09:00
vscode vscode: improve tab size and wrapping 2022-06-27 15:37:44 -07:00
workdir git-new-workdir: mark script as LF-only 2017-05-10 13:32:50 +09:00
coverage-diff.sh contrib: add coverage-diff script 2018-10-10 10:11:35 +09:00
git-resurrect.sh contrib/git-resurrect.sh: use hash-agnostic OID pattern 2020-10-08 11:48:56 -07:00
README
remotes2config.sh
rerere-train.sh contrib/rerere-train: avoid useless gpg sign in training 2022-07-19 11:24:08 -07:00

Contributed Software

Although these pieces are available as part of the official git
source tree, they are in somewhat different status.  The
intention is to keep interesting tools around git here, maybe
even experimental ones, to give users an easier access to them,
and to give tools wider exposure, so that they can be improved
faster.

I am not expecting to touch these myself that much.  As far as
my day-to-day operation is concerned, these subdirectories are
owned by their respective primary authors.  I am willing to help
if users of these components and the contrib/ subtree "owners"
have technical/design issues to resolve, but the initiative to
fix and/or enhance things _must_ be on the side of the subtree
owners.  IOW, I won't be actively looking for bugs and rooms for
enhancements in them as the git maintainer -- I may only do so
just as one of the users when I want to scratch my own itch.  If
you have patches to things in contrib/ area, the patch should be
first sent to the primary author, and then the primary author
should ack and forward it to me (git pull request is nicer).
This is the same way as how I have been treating gitk, and to a
lesser degree various foreign SCM interfaces, so you know the
drill.

I expect that things that start their life in the contrib/ area
to graduate out of contrib/ once they mature, either by becoming
projects on their own, or moving to the toplevel directory.  On
the other hand, I expect I'll be proposing removal of disused
and inactive ones from time to time.

If you have new things to add to this area, please first propose
it on the git mailing list, and after a list discussion proves
there are some general interests (it does not have to be a
list-wide consensus for a tool targeted to a relatively narrow
audience -- for example I do not work with projects whose
upstream is svn, so I have no use for git-svn myself, but it is
of general interest for people who need to interoperate with SVN
repositories in a way git-svn works better than git-svnimport),
submit a patch to create a subdirectory of contrib/ and put your
stuff there.

-jc