Skip to content

Commit f69714c

Browse files
author
Junio C Hamano
committed
Merge with master.
This merges commit c35a7b8 from master into our head commit edee414 Sincerely, jit-merge command.
2 parents edee414 + c35a7b8 commit f69714c

30 files changed

+516
-120
lines changed

Documentation/git-commit-script.txt

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
git-commit-script(1)
2+
====================
3+
v0.99.4, Aug 2005
4+
5+
NAME
6+
----
7+
git-commit-script - Record your changes
8+
9+
SYNOPSIS
10+
--------
11+
'git commit' [-a] [(-c | -C) <commit> | -F <file> | -m <msg>] <file>...
12+
13+
DESCRIPTION
14+
-----------
15+
Updates the index file for given paths, or all modified files if
16+
'-a' is specified, and makes a commit object. The command
17+
VISUAL and EDITOR environment variables to edit the commit log
18+
message.
19+
20+
OPTIONS
21+
-------
22+
-a::
23+
Update all paths in the index file.
24+
25+
-c or -C <commit>::
26+
Take existing commit object, and reuse the log message
27+
and the authorship information (including the timestamp)
28+
when creating the commit. With '-C', the editor is not
29+
invoked; with '-c' the user can further edit the commit
30+
message.
31+
32+
-F <file>::
33+
Take the commit message from the given file. Use '-' to
34+
read the message from the standard input.
35+
36+
-m <msg>::
37+
Use the given <msg> as the commit message.
38+
39+
<file>...::
40+
Update specified paths in the index file.
41+
42+
43+
Author
44+
------
45+
Written by Linus Torvalds <[email protected]>
46+
47+
GIT
48+
---
49+
Part of the link:git.html[git] suite
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
git-ls-remote-script(1)
2+
=======================
3+
v0.1, May 2005
4+
5+
NAME
6+
----
7+
git-ls-remote-script - Look at references other repository has.
8+
9+
10+
SYNOPSIS
11+
--------
12+
'git-ls-remote' [--heads] [--tags] <repository> <refs>...
13+
14+
DESCRIPTION
15+
-----------
16+
Displays the references other repository has.
17+
18+
19+
OPTIONS
20+
-------
21+
--heads --tags::
22+
Limit to only refs/heads and refs/tags, respectively.
23+
These options are _not_ mutually exclusive; when given
24+
both, references stored in refs/heads and refs/tags are
25+
displayed.
26+
27+
<repository>::
28+
Location of the repository. The shorthand defined in
29+
$GIT_DIR/branches/ can be used.
30+
31+
<refs>...::
32+
When unspecified, all references, after filtering done
33+
with --heads and --tags, are shown. When <refs>... are
34+
specified, only references matching the given patterns
35+
are displayed.
36+
37+
EXAMPLES
38+
--------
39+
40+
$ git ls-remote --tags ./.
41+
d6602ec5194c87b0fc87103ca4d67251c76f233a refs/tags/v0.99
42+
f25a265a342aed6041ab0cc484224d9ca54b6f41 refs/tags/v0.99.1
43+
7ceca275d047c90c0c7d5afb13ab97efdf51bd6e refs/tags/v0.99.3
44+
c5db5456ae3b0873fc659c19fafdde22313cc441 refs/tags/v0.99.2
45+
0918385dbd9656cab0d1d81ba7453d49bbc16250 refs/tags/junio-gpg-pub
46+
$ git ls-remote http://www.kernel.org/pub/scm/git/git.git master pu rc
47+
5fe978a5381f1fbad26a80e682ddd2a401966740 refs/heads/master
48+
c781a84b5204fb294c9ccc79f8b3baceeb32c061 refs/heads/pu
49+
b1d096f2926c4e37c9c0b6a7bf2119bedaa277cb refs/heads/rc
50+
$ echo http://www.kernel.org/pub/scm/git/git.git >.git/branches/public
51+
$ git ls-remote --tags public v\*
52+
d6602ec5194c87b0fc87103ca4d67251c76f233a refs/tags/v0.99
53+
f25a265a342aed6041ab0cc484224d9ca54b6f41 refs/tags/v0.99.1
54+
c5db5456ae3b0873fc659c19fafdde22313cc441 refs/tags/v0.99.2
55+
7ceca275d047c90c0c7d5afb13ab97efdf51bd6e refs/tags/v0.99.3
56+
57+
Author
58+
------
59+
Written by Junio C Hamano <[email protected]>
60+
61+
GIT
62+
---
63+
Part of the link:git.html[git] suite
64+

Documentation/git.txt

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ the repository, the cache and the working fileset, those that
3434
interrogate and compare them, and those that moves objects and
3535
references between repositories.
3636

37+
In addition, git itself comes with a spartan set of porcelain
38+
commands. They are usable but are not meant to compete with real
39+
Porcelains.
40+
3741
There are also some ancilliary programs that can be viewed as useful
3842
aids for using the core commands but which are unlikely to be used by
3943
SCMs layered over git.
@@ -128,14 +132,6 @@ link:git-clone-pack.html[git-clone-pack]::
128132
Clones a repository into the current repository (engine
129133
for ssh and local transport)
130134

131-
link:git-fetch-script.html[git-fetch-script]::
132-
Download from a remote repository via various protocols
133-
(user interface).
134-
135-
link:git-pull-script.html[git-pull-script]::
136-
Fetch from and merge with a remote repository via
137-
various protocols (user interface).
138-
139135
link:git-http-pull.html[git-http-pull]::
140136
Downloads a remote GIT repository via HTTP
141137

@@ -169,6 +165,18 @@ link:git-update-server-info.html[git-update-server-info]::
169165
clients discover references and packs on it.
170166

171167

168+
Porcelainish Commands
169+
---------------------
170+
link:git-fetch-script.html[git-fetch-script]::
171+
Download from a remote repository via various protocols.
172+
173+
link:git-pull-script.html[git-pull-script]::
174+
Fetch from and merge with a remote repository.
175+
176+
link:git-commit-script.html[git-commit-script]::
177+
Record changes to the repository.
178+
179+
172180
Ancilliary Commands
173181
-------------------
174182
Manipulators:

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ SCRIPTS=git git-apply-patch-script git-merge-one-file-script git-prune-script \
7070

7171
SCRIPTS += git-count-objects-script
7272
# SCRIPTS += git-send-email-script
73+
SCRIPTS += git-revert-script
7374

7475
PROG= git-update-cache git-diff-files git-init-db git-write-tree \
7576
git-read-tree git-commit-tree git-cat-file git-fsck-cache \

apply.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ static int find_header(char *line, unsigned long size, int *hdrsize, struct patc
563563
struct fragment dummy;
564564
if (parse_fragment_header(line, len, &dummy) < 0)
565565
continue;
566-
error("patch fragment without header at line %d: %.*s", linenr, len-1, line);
566+
error("patch fragment without header at line %d: %.*s", linenr, (int)len-1, line);
567567
}
568568

569569
if (size < len + 6)
@@ -968,7 +968,7 @@ static int apply_fragments(struct buffer_desc *desc, struct patch *patch)
968968

969969
while (frag) {
970970
if (apply_one_fragment(desc, frag) < 0)
971-
return error("patch failed: %s:%d", patch->old_name, frag->oldpos);
971+
return error("patch failed: %s:%ld", patch->old_name, frag->oldpos);
972972
frag = frag->next;
973973
}
974974
return 0;

cache.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
#define NORETURN
4141
#endif
4242

43+
#ifndef __attribute__
44+
#define __attribute(x)
45+
#endif
46+
4347
/*
4448
* Intensive research over the course of many years has shown that
4549
* port 9418 is totally unused by anything else. Or
@@ -171,8 +175,8 @@ extern void rollback_index_file(struct cache_file *);
171175
#define TYPE_CHANGED 0x0040
172176

173177
/* Return a statically allocated filename matching the sha1 signature */
174-
extern char *mkpath(const char *fmt, ...);
175-
extern char *git_path(const char *fmt, ...);
178+
extern char *mkpath(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
179+
extern char *git_path(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
176180
extern char *sha1_file_name(const unsigned char *sha1);
177181
extern char *sha1_pack_name(const unsigned char *sha1);
178182
extern char *sha1_pack_index_name(const unsigned char *sha1);
@@ -218,8 +222,8 @@ extern char *sha1_to_hex(const unsigned char *sha1); /* static buffer result! */
218222

219223
/* General helper functions */
220224
extern void usage(const char *err) NORETURN;
221-
extern void die(const char *err, ...) NORETURN;
222-
extern int error(const char *err, ...);
225+
extern void die(const char *err, ...) NORETURN __attribute__((format (printf, 1, 2)));
226+
extern int error(const char *err, ...) __attribute__((format (printf, 1, 2)));
223227

224228
extern int base_name_compare(const char *name1, int len1, int mode1, const char *name2, int len2, int mode2);
225229
extern int cache_name_compare(const char *name1, int len1, const char *name2, int len2);

clone-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static int is_master(struct ref *ref)
3030

3131
static void write_one_ref(struct ref *ref)
3232
{
33-
char *path = git_path(ref->name);
33+
char *path = git_path("%s", ref->name);
3434
int fd;
3535
char *hex;
3636

commit.c

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ enum cmit_fmt get_commit_format(const char *arg)
3333
return CMIT_FMT_SHORT;
3434
if (!strcmp(arg, "=full"))
3535
return CMIT_FMT_FULL;
36+
if (!strcmp(arg, "=oneline"))
37+
return CMIT_FMT_ONELINE;
3638
die("invalid --pretty format");
3739
}
3840

@@ -350,6 +352,8 @@ static int add_user_info(const char *what, enum cmit_fmt fmt, char *buf, const c
350352
unsigned long time;
351353
int tz, ret;
352354

355+
if (fmt == CMIT_FMT_ONELINE)
356+
return 0;
353357
date = strchr(line, '>');
354358
if (!date)
355359
return 0;
@@ -373,6 +377,9 @@ static int is_empty_line(const char *line, int len)
373377
static int add_parent_info(enum cmit_fmt fmt, char *buf, const char *line, int parents)
374378
{
375379
int offset = 0;
380+
381+
if (fmt == CMIT_FMT_ONELINE)
382+
return offset;
376383
switch (parents) {
377384
case 1:
378385
break;
@@ -393,6 +400,7 @@ unsigned long pretty_print_commit(enum cmit_fmt fmt, const char *msg, unsigned l
393400
int hdr = 1, body = 0;
394401
unsigned long offset = 0;
395402
int parents = 0;
403+
int indent = (fmt == CMIT_FMT_ONELINE) ? 0 : 4;
396404

397405
for (;;) {
398406
const char *line = msg;
@@ -416,7 +424,8 @@ unsigned long pretty_print_commit(enum cmit_fmt fmt, const char *msg, unsigned l
416424
if (hdr) {
417425
if (linelen == 1) {
418426
hdr = 0;
419-
buf[offset++] = '\n';
427+
if (fmt != CMIT_FMT_ONELINE)
428+
buf[offset++] = '\n';
420429
continue;
421430
}
422431
if (fmt == CMIT_FMT_RAW) {
@@ -446,13 +455,23 @@ unsigned long pretty_print_commit(enum cmit_fmt fmt, const char *msg, unsigned l
446455
} else {
447456
body = 1;
448457
}
449-
memset(buf + offset, ' ', 4);
450-
memcpy(buf + offset + 4, line, linelen);
451-
offset += linelen + 4;
458+
459+
memset(buf + offset, ' ', indent);
460+
memcpy(buf + offset + indent, line, linelen);
461+
offset += linelen + indent;
462+
if (fmt == CMIT_FMT_ONELINE)
463+
break;
464+
}
465+
if (fmt == CMIT_FMT_ONELINE) {
466+
/* We do not want the terminating newline */
467+
if (buf[offset - 1] == '\n')
468+
offset--;
469+
}
470+
else {
471+
/* Make sure there is an EOLN */
472+
if (buf[offset - 1] != '\n')
473+
buf[offset++] = '\n';
452474
}
453-
/* Make sure there is an EOLN */
454-
if (buf[offset - 1] != '\n')
455-
buf[offset++] = '\n';
456475
buf[offset] = '\0';
457476
return offset;
458477
}

commit.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ enum cmit_fmt {
4040
CMIT_FMT_DEFAULT = CMIT_FMT_MEDIUM,
4141
CMIT_FMT_SHORT,
4242
CMIT_FMT_FULL,
43+
CMIT_FMT_ONELINE,
4344
};
4445

4546
extern enum cmit_fmt get_commit_format(const char *arg);

connect.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ static int match_explicit_refs(struct ref *src, struct ref *dst,
166166
if (matched_src)
167167
break;
168168
errs = 1;
169-
error("src refspec %s does not match any.");
169+
error("src refspec %s does not match any.",
170+
rs[i].src);
170171
break;
171172
default:
172173
errs = 1;
@@ -381,8 +382,15 @@ int git_connect(int fd[2], char *url, const char *prog)
381382
close(pipefd[0][1]);
382383
close(pipefd[1][0]);
383384
close(pipefd[1][1]);
384-
if (protocol == PROTO_SSH)
385-
execlp("ssh", "ssh", host, command, NULL);
385+
if (protocol == PROTO_SSH) {
386+
const char *ssh = getenv("GIT_SSH") ? : "ssh";
387+
const char *ssh_basename = strrchr(ssh, '/');
388+
if (!ssh_basename)
389+
ssh_basename = ssh;
390+
else
391+
ssh_basename++;
392+
execlp(ssh, ssh_basename, host, command, NULL);
393+
}
386394
else
387395
execlp("sh", "sh", "-c", command, NULL);
388396
die("exec failed");

0 commit comments

Comments
 (0)