Skip to content

Commit 871e293

Browse files
committed
Merge branch 'maint-1.7.11' into maint
* maint-1.7.11: Prepare for 1.7.11.6 Make the ciabot scripts completely self-configuring in the normal case. Improved documentation for the ciabot scripts. man: git pull -r is a short for --rebase gitcli: describe abbreviation of long options rev-list docs: clarify --topo-order description Documentation/CodingGuidelines: spell out more shell guidelines Documentation: do not mention .git/refs/* directories tests: Introduce test_seq
2 parents fab4b04 + b521831 commit 871e293

19 files changed

+231
-48
lines changed

Documentation/CodingGuidelines

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,19 @@ For shell scripts specifically (not exhaustive):
7676

7777
- We do not use Process Substitution <(list) or >(list).
7878

79+
- Do not write control structures on a single line with semicolon.
80+
"then" should be on the next line for if statements, and "do"
81+
should be on the next line for "while" and "for".
82+
7983
- We prefer "test" over "[ ... ]".
8084

8185
- We do not write the noiseword "function" in front of shell
8286
functions.
8387

88+
- We prefer a space between the function name and the parentheses. The
89+
opening "{" should also be on the same line.
90+
E.g.: my_function () {
91+
8492
- As to use of grep, stick to a subset of BRE (namely, no \{m,n\},
8593
[::], [==], nor [..]) for portability.
8694

Documentation/RelNotes/1.7.11.6.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Git v1.7.11.6 Release Notes
2+
===========================
3+
4+
Fixes since v1.7.11.5
5+
---------------------
6+
7+
This is primarily documentation and low-impact code clarification.
8+
9+
- "ciabot" script (in contrib/) has been updated with extensive
10+
documentation.
11+
12+
- The "--rebase" option to "git pull" can be abbreviated to "-r",
13+
but we didn't document it.
14+
15+
- It was generally understood that "--long-option"s to many of our
16+
subcommands can be abbreviated to the unique prefix, but it was not
17+
easy to find it described for new readers of the documentation set.
18+
19+
- The "--topo-order", "--date-order" (and the lack of either means
20+
the default order) options to "rev-list" and "log" family of
21+
commands were poorly described in the documentation.
22+
23+
- Older parts of the documentation described as if having a regular
24+
file in .git/refs/ hierarchy were the only way to have branches and
25+
tags, which is not true for quite some time.
26+
27+
- A utility shell function test_seq has been added as a replacement
28+
for the 'seq' utility found on some platforms.
29+
30+
- Fallback 'getpass' implementation made unportable use of stdio API.
31+
32+
- "git commit --amend" let the user edit the log message and then
33+
died when the human-readable committer name was given
34+
insufficiently by getpwent(3).

Documentation/git-describe.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ OPTIONS
3636

3737
--all::
3838
Instead of using only the annotated tags, use any ref
39-
found in `.git/refs/`. This option enables matching
39+
found in `refs/` namespace. This option enables matching
4040
any known branch, remote-tracking branch, or lightweight tag.
4141

4242
--tags::
4343
Instead of using only the annotated tags, use any tag
44-
found in `.git/refs/tags`. This option enables matching
44+
found in `refs/tags` namespace. This option enables matching
4545
a lightweight (non-annotated) tag.
4646

4747
--contains::

Documentation/git-filter-branch.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ changes, which would normally have no effect. Nevertheless, this may be
3232
useful in the future for compensating for some git bugs or such,
3333
therefore such a usage is permitted.
3434

35-
*NOTE*: This command honors `.git/info/grafts` and `.git/refs/replace/`.
35+
*NOTE*: This command honors `.git/info/grafts` file and refs in
36+
the `refs/replace/` namespace.
3637
If you have any grafts or replacement refs defined, running this command
3738
will make them permanent.
3839

Documentation/git-fsck.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ OPTIONS
2323
An object to treat as the head of an unreachability trace.
2424
+
2525
If no objects are given, 'git fsck' defaults to using the
26-
index file, all SHA1 references in .git/refs/*, and all reflogs (unless
27-
--no-reflogs is given) as heads.
26+
index file, all SHA1 references in `refs` namespace, and all reflogs
27+
(unless --no-reflogs is given) as heads.
2828

2929
--unreachable::
3030
Print out objects that exist but that aren't reachable from any

Documentation/git-lost-found.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ $ gitk $(cd .git/lost-found/commit && echo ??*)
4848
------------
4949

5050
After making sure you know which the object is the tag you are looking
51-
for, you can reconnect it to your regular .git/refs hierarchy.
51+
for, you can reconnect it to your regular `refs` hierarchy by using
52+
the `update-ref` command.
5253

5354
------------
5455
$ git cat-file -t 1ef2b196

Documentation/git-pack-refs.txt

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,23 @@ DESCRIPTION
1414
-----------
1515

1616
Traditionally, tips of branches and tags (collectively known as
17-
'refs') were stored one file per ref under `$GIT_DIR/refs`
17+
'refs') were stored one file per ref in a (sub)directory
18+
under `$GIT_DIR/refs`
1819
directory. While many branch tips tend to be updated often,
1920
most tags and some branch tips are never updated. When a
2021
repository has hundreds or thousands of tags, this
2122
one-file-per-ref format both wastes storage and hurts
2223
performance.
2324

2425
This command is used to solve the storage and performance
25-
problem by stashing the refs in a single file,
26+
problem by storing the refs in a single file,
2627
`$GIT_DIR/packed-refs`. When a ref is missing from the
27-
traditional `$GIT_DIR/refs` hierarchy, it is looked up in this
28+
traditional `$GIT_DIR/refs` directory hierarchy, it is looked
29+
up in this
2830
file and used if found.
2931

3032
Subsequent updates to branches always create new files under
31-
`$GIT_DIR/refs` hierarchy.
33+
`$GIT_DIR/refs` directory hierarchy.
3234

3335
A recommended practice to deal with a repository with too many
3436
refs is to pack its refs with `--all --prune` once, and
@@ -57,6 +59,15 @@ a repository with many branches of historical interests.
5759
The command usually removes loose refs under `$GIT_DIR/refs`
5860
hierarchy after packing them. This option tells it not to.
5961

62+
63+
BUGS
64+
----
65+
66+
Older documentation written before the packed-refs mechanism was
67+
introduced may still say things like ".git/refs/heads/<branch> file
68+
exists" when it means "branch <branch> exists".
69+
70+
6071
GIT
6172
---
6273
Part of the linkgit:git[1] suite

Documentation/git-pull.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ include::merge-options.txt[]
101101

102102
:git-pull: 1
103103

104+
-r::
104105
--rebase::
105106
Rebase the current branch on top of the upstream branch after
106107
fetching. If there is a remote-tracking branch corresponding to

Documentation/git-replace.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ SYNOPSIS
1414

1515
DESCRIPTION
1616
-----------
17-
Adds a 'replace' reference in `.git/refs/replace/`
17+
Adds a 'replace' reference in `refs/replace/` namespace.
1818

1919
The name of the 'replace' reference is the SHA1 of the object that is
2020
replaced. The content of the 'replace' reference is the SHA1 of the
2121
replacement object.
2222

23-
Unless `-f` is given, the 'replace' reference must not yet exist in
24-
`.git/refs/replace/` directory.
23+
Unless `-f` is given, the 'replace' reference must not yet exist.
2524

2625
Replacement references will be used by default by all git commands
2726
except those doing reachability traversal (prune, pack transfer and

Documentation/git-tag.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ SYNOPSIS
2020
DESCRIPTION
2121
-----------
2222

23-
Add a tag reference in `.git/refs/tags/`, unless `-d/-l/-v` is given
23+
Add a tag reference in `refs/tags/`, unless `-d/-l/-v` is given
2424
to delete, list or verify tags.
2525

26-
Unless `-f` is given, the tag to be created must not yet exist in the
27-
`.git/refs/tags/` directory.
26+
Unless `-f` is given, the named tag must not yet exist.
2827

2928
If one of `-a`, `-s`, or `-u <key-id>` is passed, the command
3029
creates a 'tag' object, and requires a tag message. Unless

Documentation/gitcli.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ scripting git:
6262
`git log -1 HEAD` but write `git log -1 HEAD --`; the former will not work
6363
if you happen to have a file called `HEAD` in the work tree.
6464

65+
* many commands allow a long option "--option" to be abbreviated
66+
only to their unique prefix (e.g. if there is no other option
67+
whose name begins with "opt", you may be able to spell "--opt" to
68+
invoke the "--option" flag), but you should fully spell them out
69+
when writing your scripts; later versions of Git may introduce a
70+
new option whose name shares the same prefix, e.g. "--optimize",
71+
to make a short prefix that used to be unique no longer unique.
72+
6573

6674
ENHANCED OPTION PARSER
6775
----------------------

Documentation/rev-list-options.txt

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -578,16 +578,33 @@ Commit Ordering
578578

579579
By default, the commits are shown in reverse chronological order.
580580

581-
--topo-order::
581+
--date-order::
582+
Show no parents before all of its children are shown, but
583+
otherwise show commits in the commit timestamp order.
582584

583-
This option makes them appear in topological order (i.e.
584-
descendant commits are shown before their parents).
585+
--topo-order::
586+
Show no parents before all of its children are shown, and
587+
avoid showing commits on multiple lines of history
588+
intermixed.
589+
+
590+
For example, in a commit history like this:
591+
+
592+
----------------------------------------------------------------
585593

586-
--date-order::
594+
---1----2----4----7
595+
\ \
596+
3----5----6----8---
587597

588-
This option is similar to '--topo-order' in the sense that no
589-
parent comes before all of its children, but otherwise things
590-
are still ordered in the commit timestamp order.
598+
----------------------------------------------------------------
599+
+
600+
where the numbers denote the order of commit timestamps, `git
601+
rev-list` and friends with `--date-order` show the commits in the
602+
timestamp order: 8 7 6 5 4 3 2 1.
603+
+
604+
With `--topo-order`, they would show 8 6 5 3 7 4 2 1 (or 8 7 4 2 6 5
605+
3 1); some older commits are shown before newer ones in order to
606+
avoid showing the commits from two parallel development track mixed
607+
together.
591608

592609
--reverse::
593610

contrib/ciabot/INSTALL

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
= Installation instructions =
2+
3+
Two scripts are included. The Python one (ciabot.py) is faster and
4+
more capable; the shell one (ciabot.sh) is a fallback in case Python
5+
gives your git hosting site indigestion. (I know of no such sites.)
6+
7+
It is no longer necessary to modify the script in order to put it
8+
in place; in fact, this is now discouraged. It is entirely
9+
configurable with the following git config variables:
10+
11+
ciabot.project = name of the project
12+
ciabot.repo = name of the project repo for gitweb/cgit purposes
13+
ciabot.xmlrpc = if true, ship notifications via XML-RPC
14+
ciabot.revformat = format in which the revision is shown
15+
16+
The revformat variable may have the following values
17+
raw -> full hex ID of commit
18+
short -> first 12 chars of hex ID
19+
describe -> describe relative to last tag, falling back to short
20+
21+
ciabot.project defaults to the directory name of the repository toplevel.
22+
ciabot.repo defaults to ciabot.project lowercased.
23+
ciabot.xmlrpc defaults to True
24+
ciabot.revformat defaults to 'describe'.
25+
26+
This means that in the normal case you need not do any configuration at all,
27+
however setting ciabot.project will allow the hook to run slightly faster.
28+
29+
Once you've set these variables, try your script with -n to see the
30+
notification message dumped to stdout and verify that it looks sane.
31+
32+
To live-test these scripts, your project needs to have been registered with
33+
the CIA site. Here are the steps:
34+
35+
1. Open an IRC window on irc://freenode/commits or your registered
36+
project IRC channel.
37+
38+
2. Run ciabot.py and/or ciabot.sh from any directory under git
39+
control.
40+
41+
You should see a notification on the channel for your most recent commit.
42+
43+
After verifying correct function, install one of these scripts either
44+
in a post-commit hook or in an update hook.
45+
46+
In post-commit, run it without arguments. It will query for
47+
current HEAD and the latest commit ID to get the information it
48+
needs.
49+
50+
In update, call it with a refname followed by a list of commits:
51+
You want to reverse the order git rev-list emits because it lists
52+
from most recent to oldest.
53+
54+
/path/to/ciabot.py ${refname} $(git rev-list ${oldhead}..${newhead} | tac)

contrib/ciabot/README

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ You probably want the Python version; it's faster, more capable, and
88
better documented. The shell version is maintained only as a fallback
99
for use on hosting sites that don't permit Python hook scripts.
1010

11-
You will find installation instructions for each script in its comment
12-
header.
11+
See the file INSTALL for installation instructions.

contrib/ciabot/ciabot.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@
1010
# usage: ciabot.py [-V] [-n] [-p projectname] [refname [commits...]]
1111
#
1212
# This script is meant to be run either in a post-commit hook or in an
13-
# update hook. If there's nothing unusual about your hosting setup,
14-
# you can specify the project name and repo with config variables and
15-
# avoid having to modify this script. Try it with -n to see the
16-
# notification mail dumped to stdout and verify that it looks
17-
# sane. With -V it dumps its version and exits.
13+
# update hook. Try it with -n to see the notification mail dumped to
14+
# stdout and verify that it looks sane. With -V it dumps its version
15+
# and exits.
1816
#
1917
# In post-commit, run it without arguments. It will query for
2018
# current HEAD and the latest commit ID to get the information it
@@ -27,12 +25,17 @@
2725
# /path/to/ciabot.py ${refname} $(git rev-list ${oldhead}..${newhead} | tac)
2826
#
2927
# Configuration variables affecting this script:
30-
# ciabot.project = name of the project (required)
28+
#
29+
# ciabot.project = name of the project
3130
# ciabot.repo = name of the project repo for gitweb/cgit purposes
3231
# ciabot.xmlrpc = if true (default), ship notifications via XML-RPC
3332
# ciabot.revformat = format in which the revision is shown
3433
#
35-
# The ciabot.repo value defaults to ciabot.project lowercased.
34+
# ciabot.project defaults to the directory name of the repository toplevel.
35+
# ciabot.repo defaults to ciabot.project lowercased.
36+
#
37+
# This means that in the normal case you need not do any configuration at all,
38+
# but setting the project name will speed it up slightly.
3639
#
3740
# The revformat variable may have the following values
3841
# raw -> full hex ID of commit
@@ -102,7 +105,7 @@
102105
# Identify the generator script.
103106
# Should only change when the script itself gets a new home and maintainer.
104107
generator = "http://www.catb.org/~esr/ciabot.py"
105-
version = "3.5"
108+
version = "3.6"
106109

107110
def do(command):
108111
return commands.getstatusoutput(command)[1]
@@ -192,10 +195,17 @@ def report(refname, merged, xmlrpc=True):
192195
print "ciabot.py: version", version
193196
sys.exit(0)
194197

195-
# Cough and die if user has not specified a project
198+
# The project variable defaults to the name of the repository toplevel.
196199
if not project:
197-
sys.stderr.write("ciabot.py: no project specified, bailing out.\n")
198-
sys.exit(1)
200+
here = os.getcwd()
201+
while True:
202+
if os.path.exists(os.path.join(here, ".git")):
203+
project = os.path.basename(here)
204+
break
205+
elif here == '/':
206+
sys.stderr.write("ciabot.py: no .git below root!\n")
207+
sys.exit(1)
208+
here = os.path.dirname(here)
199209

200210
if not repo:
201211
repo = project.lower()

0 commit comments

Comments
 (0)