Merge branch 'master' into jc/fsck-reflog

* master:
  Introduce a global level warn() function.
  Rename imap-send's internal info/warn functions.
  _XOPEN_SOURCE problem also exists on FreeBSD
  parse-remote: mark all refs not for merge only when fetching more than one
  git-reset --hard: tell the user what the HEAD was reset to
  git-tag: support -F <file> option
  Revert "git-pull: refuse default merge without branch.*.merge"
  Suggest 'add' in am/revert/cherry-pick.
  Use git-merge-file in git-merge-one-file, too
  diff --check: fix off by one error
  Documentation/git-branch: new -r to delete remote-tracking branches.
  Fix system header problems on Mac OS X
  spurious .sp in manpages
maint
Junio C Hamano 2006-12-21 23:01:45 -08:00
commit 90cee090a0
12 changed files with 81 additions and 29 deletions

View File

@ -11,7 +11,7 @@ SYNOPSIS
'git-branch' [-r | -a] [-v [--abbrev=<length>]] 'git-branch' [-r | -a] [-v [--abbrev=<length>]]
'git-branch' [-l] [-f] <branchname> [<start-point>] 'git-branch' [-l] [-f] <branchname> [<start-point>]
'git-branch' (-m | -M) [<oldbranch>] <newbranch> 'git-branch' (-m | -M) [<oldbranch>] <newbranch>
'git-branch' (-d | -D) <branchname>... 'git-branch' (-d | -D) [-r] <branchname>...


DESCRIPTION DESCRIPTION
----------- -----------
@ -33,7 +33,8 @@ to happen.


With a `-d` or `-D` option, `<branchname>` will be deleted. You may With a `-d` or `-D` option, `<branchname>` will be deleted. You may
specify more than one branch for deletion. If the branch currently specify more than one branch for deletion. If the branch currently
has a ref log then the ref log will also be deleted. has a ref log then the ref log will also be deleted. Use -r together with -d
to delete remote-tracking branches.




OPTIONS OPTIONS
@ -60,7 +61,7 @@ OPTIONS
Move/rename a branch even if the new branchname already exists. Move/rename a branch even if the new branchname already exists.


-r:: -r::
List the remote-tracking branches. List or delete (if used with -d) the remote-tracking branches.


-a:: -a::
List both remote-tracking branches and local branches. List both remote-tracking branches and local branches.
@ -111,10 +112,12 @@ Delete unneeded branch::
------------ ------------
$ git clone git://git.kernel.org/.../git.git my.git $ git clone git://git.kernel.org/.../git.git my.git
$ cd my.git $ cd my.git
$ git branch -D todo <1> $ git branch -d -r todo html man <1>
$ git branch -D test <2>
------------ ------------
+ +
<1> delete todo branch even if the "master" branch does not have all <1> delete remote-tracking branches "todo", "html", "man"
<2> delete "test" branch even if the "master" branch does not have all
commits from todo branch. commits from todo branch.





View File

@ -9,7 +9,8 @@ git-tag - Create a tag object signed with GPG
SYNOPSIS SYNOPSIS
-------- --------
[verse] [verse]
'git-tag' [-a | -s | -u <key-id>] [-f | -d] [-m <msg>] <name> [<head>] 'git-tag' [-a | -s | -u <key-id>] [-f | -d] [-m <msg> | -F <file>]
<name> [<head>]
'git-tag' -l [<pattern>] 'git-tag' -l [<pattern>]


DESCRIPTION DESCRIPTION
@ -60,6 +61,9 @@ OPTIONS
-m <msg>:: -m <msg>::
Use the given tag message (instead of prompting) Use the given tag message (instead of prompting)


-F <file>::
Take the tag message from the given file. Use '-' to
read the message from the standard input.


Author Author
------ ------

4
diff.c
View File

@ -860,8 +860,6 @@ static void checkdiff_consume(void *priv, char *line, unsigned long len)
if (line[0] == '+') { if (line[0] == '+') {
int i, spaces = 0; int i, spaces = 0;


data->lineno++;

/* check space before tab */ /* check space before tab */
for (i = 1; i < len && (line[i] == ' ' || line[i] == '\t'); i++) for (i = 1; i < len && (line[i] == ' ' || line[i] == '\t'); i++)
if (line[i] == ' ') if (line[i] == ' ')
@ -876,6 +874,8 @@ static void checkdiff_consume(void *priv, char *line, unsigned long len)
if (isspace(line[len - 1])) if (isspace(line[len - 1]))
printf("%s:%d: white space at end: %.*s\n", printf("%s:%d: white space at end: %.*s\n",
data->filename, data->lineno, (int)len, line); data->filename, data->lineno, (int)len, line);

data->lineno++;
} else if (line[0] == ' ') } else if (line[0] == ' ')
data->lineno++; data->lineno++;
else if (line[0] == '@') { else if (line[0] == '@') {

View File

@ -401,14 +401,14 @@ do
changed="$(git-diff-index --cached --name-only HEAD)" changed="$(git-diff-index --cached --name-only HEAD)"
if test '' = "$changed" if test '' = "$changed"
then then
echo "No changes - did you forget update-index?" echo "No changes - did you forget to use 'git add'?"
stop_here_user_resolve $this stop_here_user_resolve $this
fi fi
unmerged=$(git-ls-files -u) unmerged=$(git-ls-files -u)
if test -n "$unmerged" if test -n "$unmerged"
then then
echo "You still have unmerged paths in your index" echo "You still have unmerged paths in your index"
echo "did you forget update-index?" echo "did you forget to use 'git add'?"
stop_here_user_resolve $this stop_here_user_resolve $this
fi fi
apply_status=0 apply_status=0

View File

@ -11,8 +11,10 @@


#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))


#if !defined(__APPLE__) && !defined(__FreeBSD)
#define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */ #define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */
#define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */ #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
#endif
#define _GNU_SOURCE #define _GNU_SOURCE
#define _BSD_SOURCE #define _BSD_SOURCE


@ -69,10 +71,12 @@
extern void usage(const char *err) NORETURN; extern void usage(const char *err) NORETURN;
extern void die(const char *err, ...) NORETURN __attribute__((format (printf, 1, 2))); extern void die(const char *err, ...) NORETURN __attribute__((format (printf, 1, 2)));
extern int error(const char *err, ...) __attribute__((format (printf, 1, 2))); extern int error(const char *err, ...) __attribute__((format (printf, 1, 2)));
extern void warn(const char *err, ...) __attribute__((format (printf, 1, 2)));


extern void set_usage_routine(void (*routine)(const char *err) NORETURN); extern void set_usage_routine(void (*routine)(const char *err) NORETURN);
extern void set_die_routine(void (*routine)(const char *err, va_list params) NORETURN); extern void set_die_routine(void (*routine)(const char *err, va_list params) NORETURN);
extern void set_error_routine(void (*routine)(const char *err, va_list params)); extern void set_error_routine(void (*routine)(const char *err, va_list params));
extern void set_warn_routine(void (*routine)(const char *warn, va_list params));


#ifdef NO_MMAP #ifdef NO_MMAP



View File

@ -104,7 +104,7 @@ case "${1:-.}${2:-.}${3:-.}" in
# Be careful for funny filename such as "-L" in "$4", which # Be careful for funny filename such as "-L" in "$4", which
# would confuse "merge" greatly. # would confuse "merge" greatly.
src1=`git-unpack-file $2` src1=`git-unpack-file $2`
merge "$src1" "$orig" "$src2" git-merge-file "$src1" "$orig" "$src2"
ret=$? ret=$?


# Create the working tree file, using "our tree" version from the # Create the working tree file, using "our tree" version from the

View File

@ -136,16 +136,22 @@ canon_refs_list_for_fetch () {
if test "$1" = "-d" if test "$1" = "-d"
then then
shift ; remote="$1" ; shift shift ; remote="$1" ; shift
set x $(expand_refs_wildcard "$@")
shift
if test "$remote" = "$(get_default_remote)" if test "$remote" = "$(get_default_remote)"
then then
curr_branch=$(git-symbolic-ref HEAD | \ curr_branch=$(git-symbolic-ref HEAD | \
sed -e 's|^refs/heads/||') sed -e 's|^refs/heads/||')
merge_branches=$(git-repo-config \ merge_branches=$(git-repo-config \
--get-all "branch.${curr_branch}.merge") || --get-all "branch.${curr_branch}.merge")
merge_branches=.this.would.never.match.any.ref. fi
# If we are fetching only one branch, then first branch
# is the only thing that makes sense to merge anyway,
# so there is no point refusing that traditional rule.
if test $# != 1 && test "z$merge_branches" = z
then
merge_branches=..this..would..never..match..
fi fi
set x $(expand_refs_wildcard "$@")
shift
fi fi
for ref for ref
do do

View File

@ -86,7 +86,12 @@ update_ref_status=$?


case "$reset_type" in case "$reset_type" in
--hard ) --hard )
;; # Nothing else to do test $update_ref_status = 0 && {
echo -n "HEAD is now at "
GIT_PAGER= git log --max-count=1 --pretty=oneline \
--abbrev-commit HEAD
}
;;
--soft ) --soft )
;; # Nothing else to do ;; # Nothing else to do
--mixed ) --mixed )

View File

@ -155,7 +155,7 @@ Conflicts:
uniq uniq
} >>"$GIT_DIR/MERGE_MSG" } >>"$GIT_DIR/MERGE_MSG"
echo >&2 "Automatic $me failed. After resolving the conflicts," echo >&2 "Automatic $me failed. After resolving the conflicts,"
echo >&2 "mark the corrected paths with 'git-update-index <paths>'" echo >&2 "mark the corrected paths with 'git-add <paths>'"
echo >&2 "and commit the result." echo >&2 "and commit the result."
case "$me" in case "$me" in
cherry-pick) cherry-pick)

View File

@ -45,6 +45,17 @@ do
message_given=1 message_given=1
fi fi
;; ;;
-F)
annotate=1
shift
if test "$#" = "0"; then
die "error: option -F needs an argument"
exit 2
else
message="$(cat "$1")"
message_given=1
fi
;;
-u) -u)
annotate=1 annotate=1
signed=1 signed=1

View File

@ -96,8 +96,8 @@ typedef struct {


static int Verbose, Quiet; static int Verbose, Quiet;


static void info( const char *, ... ); static void imap_info( const char *, ... );
static void warn( const char *, ... ); static void imap_warn( const char *, ... );


static char *next_arg( char ** ); static char *next_arg( char ** );


@ -297,7 +297,7 @@ buffer_gets( buffer_t * b, char **s )
} }


static void static void
info( const char *msg, ... ) imap_info( const char *msg, ... )
{ {
va_list va; va_list va;


@ -310,7 +310,7 @@ info( const char *msg, ... )
} }


static void static void
warn( const char *msg, ... ) imap_warn( const char *msg, ... )
{ {
va_list va; va_list va;


@ -903,7 +903,7 @@ imap_open_store( imap_server_conf_t *srvc )
/* open connection to IMAP server */ /* open connection to IMAP server */


if (srvc->tunnel) { if (srvc->tunnel) {
info( "Starting tunnel '%s'... ", srvc->tunnel ); imap_info( "Starting tunnel '%s'... ", srvc->tunnel );


if (socketpair( PF_UNIX, SOCK_STREAM, 0, a )) { if (socketpair( PF_UNIX, SOCK_STREAM, 0, a )) {
perror( "socketpair" ); perror( "socketpair" );
@ -926,31 +926,31 @@ imap_open_store( imap_server_conf_t *srvc )


imap->buf.sock.fd = a[1]; imap->buf.sock.fd = a[1];


info( "ok\n" ); imap_info( "ok\n" );
} else { } else {
memset( &addr, 0, sizeof(addr) ); memset( &addr, 0, sizeof(addr) );
addr.sin_port = htons( srvc->port ); addr.sin_port = htons( srvc->port );
addr.sin_family = AF_INET; addr.sin_family = AF_INET;


info( "Resolving %s... ", srvc->host ); imap_info( "Resolving %s... ", srvc->host );
he = gethostbyname( srvc->host ); he = gethostbyname( srvc->host );
if (!he) { if (!he) {
perror( "gethostbyname" ); perror( "gethostbyname" );
goto bail; goto bail;
} }
info( "ok\n" ); imap_info( "ok\n" );


addr.sin_addr.s_addr = *((int *) he->h_addr_list[0]); addr.sin_addr.s_addr = *((int *) he->h_addr_list[0]);


s = socket( PF_INET, SOCK_STREAM, 0 ); s = socket( PF_INET, SOCK_STREAM, 0 );


info( "Connecting to %s:%hu... ", inet_ntoa( addr.sin_addr ), ntohs( addr.sin_port ) ); imap_info( "Connecting to %s:%hu... ", inet_ntoa( addr.sin_addr ), ntohs( addr.sin_port ) );
if (connect( s, (struct sockaddr *)&addr, sizeof(addr) )) { if (connect( s, (struct sockaddr *)&addr, sizeof(addr) )) {
close( s ); close( s );
perror( "connect" ); perror( "connect" );
goto bail; goto bail;
} }
info( "ok\n" ); imap_info( "ok\n" );


imap->buf.sock.fd = s; imap->buf.sock.fd = s;


@ -979,7 +979,7 @@ imap_open_store( imap_server_conf_t *srvc )


if (!preauth) { if (!preauth) {


info ("Logging in...\n"); imap_info ("Logging in...\n");
if (!srvc->user) { if (!srvc->user) {
fprintf( stderr, "Skipping server %s, no user\n", srvc->host ); fprintf( stderr, "Skipping server %s, no user\n", srvc->host );
goto bail; goto bail;
@ -1006,7 +1006,7 @@ imap_open_store( imap_server_conf_t *srvc )
fprintf( stderr, "Skipping account %s@%s, server forbids LOGIN\n", srvc->user, srvc->host ); fprintf( stderr, "Skipping account %s@%s, server forbids LOGIN\n", srvc->user, srvc->host );
goto bail; goto bail;
} }
warn( "*** IMAP Warning *** Password is being sent in the clear\n" ); imap_warn( "*** IMAP Warning *** Password is being sent in the clear\n" );
if (imap_exec( ctx, NULL, "LOGIN \"%s\" \"%s\"", srvc->user, srvc->pass ) != RESP_OK) { if (imap_exec( ctx, NULL, "LOGIN \"%s\" \"%s\"", srvc->user, srvc->pass ) != RESP_OK) {
fprintf( stderr, "IMAP error: LOGIN failed\n" ); fprintf( stderr, "IMAP error: LOGIN failed\n" );
goto bail; goto bail;

19
usage.c
View File

@ -29,12 +29,17 @@ static void error_builtin(const char *err, va_list params)
report("error: ", err, params); report("error: ", err, params);
} }


static void warn_builtin(const char *warn, va_list params)
{
report("warning: ", warn, params);
}


/* If we are in a dlopen()ed .so write to a global variable would segfault /* If we are in a dlopen()ed .so write to a global variable would segfault
* (ugh), so keep things static. */ * (ugh), so keep things static. */
static void (*usage_routine)(const char *err) NORETURN = usage_builtin; static void (*usage_routine)(const char *err) NORETURN = usage_builtin;
static void (*die_routine)(const char *err, va_list params) NORETURN = die_builtin; static void (*die_routine)(const char *err, va_list params) NORETURN = die_builtin;
static void (*error_routine)(const char *err, va_list params) = error_builtin; static void (*error_routine)(const char *err, va_list params) = error_builtin;
static void (*warn_routine)(const char *err, va_list params) = warn_builtin;


void set_usage_routine(void (*routine)(const char *err) NORETURN) void set_usage_routine(void (*routine)(const char *err) NORETURN)
{ {
@ -51,6 +56,11 @@ void set_error_routine(void (*routine)(const char *err, va_list params))
error_routine = routine; error_routine = routine;
} }


void set_warn_routine(void (*routine)(const char *warn, va_list params))
{
warn_routine = routine;
}



void usage(const char *err) void usage(const char *err)
{ {
@ -75,3 +85,12 @@ int error(const char *err, ...)
va_end(params); va_end(params);
return -1; return -1;
} }

void warn(const char *warn, ...)
{
va_list params;

va_start(params, warn);
warn_routine(warn, params);
va_end(params);
}