Merge branch 'master' into next
* master: Optionally do not list empty directories in git-ls-files --others Document git-rebase behavior on conflicts. Fix error handling for nonexistent names
This commit is contained in:
@ -52,6 +52,9 @@ OPTIONS
|
|||||||
If a whole directory is classified as "other", show just its
|
If a whole directory is classified as "other", show just its
|
||||||
name (with a trailing slash) and not its whole contents.
|
name (with a trailing slash) and not its whole contents.
|
||||||
|
|
||||||
|
--no-empty-directory::
|
||||||
|
Do not list empty directories. Has no effect without --directory.
|
||||||
|
|
||||||
-u|--unmerged::
|
-u|--unmerged::
|
||||||
Show unmerged files in the output (forces --stage)
|
Show unmerged files in the output (forces --stage)
|
||||||
|
|
||||||
|
@ -48,6 +48,18 @@ would be:
|
|||||||
/
|
/
|
||||||
D---E---F---G master
|
D---E---F---G master
|
||||||
|
|
||||||
|
In case of conflict, git-rebase will stop at the first problematic commit
|
||||||
|
and leave conflict markers in the tree. After resolving the conflict manually
|
||||||
|
and updating the index with the desired resolution, you can continue the
|
||||||
|
rebasing process with
|
||||||
|
|
||||||
|
git am --resolved --3way
|
||||||
|
|
||||||
|
Alternatively, you can undo the git-rebase with
|
||||||
|
|
||||||
|
git reset --hard ORIG_HEAD
|
||||||
|
rm -r .dotest
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
-------
|
-------
|
||||||
<newbase>::
|
<newbase>::
|
||||||
|
33
ls-files.c
33
ls-files.c
@ -21,6 +21,7 @@ static int show_unmerged = 0;
|
|||||||
static int show_modified = 0;
|
static int show_modified = 0;
|
||||||
static int show_killed = 0;
|
static int show_killed = 0;
|
||||||
static int show_other_directories = 0;
|
static int show_other_directories = 0;
|
||||||
|
static int hide_empty_directories = 0;
|
||||||
static int show_valid_bit = 0;
|
static int show_valid_bit = 0;
|
||||||
static int line_terminator = '\n';
|
static int line_terminator = '\n';
|
||||||
|
|
||||||
@ -259,11 +260,12 @@ static int dir_exists(const char *dirname, int len)
|
|||||||
* Also, we ignore the name ".git" (even if it is not a directory).
|
* Also, we ignore the name ".git" (even if it is not a directory).
|
||||||
* That likely will not change.
|
* That likely will not change.
|
||||||
*/
|
*/
|
||||||
static void read_directory(const char *path, const char *base, int baselen)
|
static int read_directory(const char *path, const char *base, int baselen)
|
||||||
{
|
{
|
||||||
DIR *dir = opendir(path);
|
DIR *fdir = opendir(path);
|
||||||
|
int contents = 0;
|
||||||
|
|
||||||
if (dir) {
|
if (fdir) {
|
||||||
int exclude_stk;
|
int exclude_stk;
|
||||||
struct dirent *de;
|
struct dirent *de;
|
||||||
char fullname[MAXPATHLEN + 1];
|
char fullname[MAXPATHLEN + 1];
|
||||||
@ -271,7 +273,7 @@ static void read_directory(const char *path, const char *base, int baselen)
|
|||||||
|
|
||||||
exclude_stk = push_exclude_per_directory(base, baselen);
|
exclude_stk = push_exclude_per_directory(base, baselen);
|
||||||
|
|
||||||
while ((de = readdir(dir)) != NULL) {
|
while ((de = readdir(fdir)) != NULL) {
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
if ((de->d_name[0] == '.') &&
|
if ((de->d_name[0] == '.') &&
|
||||||
@ -289,6 +291,7 @@ static void read_directory(const char *path, const char *base, int baselen)
|
|||||||
|
|
||||||
switch (DTYPE(de)) {
|
switch (DTYPE(de)) {
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
int subdir, rewind_base;
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
case DT_UNKNOWN:
|
case DT_UNKNOWN:
|
||||||
@ -302,22 +305,32 @@ static void read_directory(const char *path, const char *base, int baselen)
|
|||||||
case DT_DIR:
|
case DT_DIR:
|
||||||
memcpy(fullname + baselen + len, "/", 2);
|
memcpy(fullname + baselen + len, "/", 2);
|
||||||
len++;
|
len++;
|
||||||
|
rewind_base = nr_dir;
|
||||||
|
subdir = read_directory(fullname, fullname,
|
||||||
|
baselen + len);
|
||||||
if (show_other_directories &&
|
if (show_other_directories &&
|
||||||
!dir_exists(fullname, baselen + len))
|
(subdir || !hide_empty_directories) &&
|
||||||
|
!dir_exists(fullname, baselen + len)) {
|
||||||
|
// Rewind the read subdirectory
|
||||||
|
while (nr_dir > rewind_base)
|
||||||
|
free(dir[--nr_dir]);
|
||||||
break;
|
break;
|
||||||
read_directory(fullname, fullname,
|
}
|
||||||
baselen + len);
|
contents += subdir;
|
||||||
continue;
|
continue;
|
||||||
case DT_REG:
|
case DT_REG:
|
||||||
case DT_LNK:
|
case DT_LNK:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
add_name(fullname, baselen + len);
|
add_name(fullname, baselen + len);
|
||||||
|
contents++;
|
||||||
}
|
}
|
||||||
closedir(dir);
|
closedir(fdir);
|
||||||
|
|
||||||
pop_exclude_per_directory(exclude_stk);
|
pop_exclude_per_directory(exclude_stk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmp_name(const void *p1, const void *p2)
|
static int cmp_name(const void *p1, const void *p2)
|
||||||
@ -699,6 +712,10 @@ int main(int argc, const char **argv)
|
|||||||
show_other_directories = 1;
|
show_other_directories = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (!strcmp(arg, "--no-empty-directory")) {
|
||||||
|
hide_empty_directories = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!strcmp(arg, "-u") || !strcmp(arg, "--unmerged")) {
|
if (!strcmp(arg, "-u") || !strcmp(arg, "--unmerged")) {
|
||||||
/* There's no point in showing unmerged unless
|
/* There's no point in showing unmerged unless
|
||||||
* you also show the stage information.
|
* you also show the stage information.
|
||||||
|
@ -172,9 +172,11 @@ int main(int argc, char **argv)
|
|||||||
struct stat st;
|
struct stat st;
|
||||||
char *arg = argv[i];
|
char *arg = argv[i];
|
||||||
char *dotdot;
|
char *dotdot;
|
||||||
|
|
||||||
if (as_is) {
|
if (as_is) {
|
||||||
show_file(arg);
|
if (show_file(arg) && as_is < 2)
|
||||||
|
if (lstat(arg, &st) < 0)
|
||||||
|
die("'%s': %s", arg, strerror(errno));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!strcmp(arg,"-n")) {
|
if (!strcmp(arg,"-n")) {
|
||||||
@ -194,7 +196,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if (*arg == '-') {
|
if (*arg == '-') {
|
||||||
if (!strcmp(arg, "--")) {
|
if (!strcmp(arg, "--")) {
|
||||||
as_is = 1;
|
as_is = 2;
|
||||||
/* Pass on the "--" if we show anything but files.. */
|
/* Pass on the "--" if we show anything but files.. */
|
||||||
if (filter & (DO_FLAGS | DO_REVS))
|
if (filter & (DO_FLAGS | DO_REVS))
|
||||||
show_file(arg);
|
show_file(arg);
|
||||||
|
@ -649,7 +649,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
|
|||||||
/* If we didn't have a "--", all filenames must exist */
|
/* If we didn't have a "--", all filenames must exist */
|
||||||
for (j = i; j < argc; j++) {
|
for (j = i; j < argc; j++) {
|
||||||
if (lstat(argv[j], &st) < 0)
|
if (lstat(argv[j], &st) < 0)
|
||||||
die("'%s': %s", arg, strerror(errno));
|
die("'%s': %s", argv[j], strerror(errno));
|
||||||
}
|
}
|
||||||
revs->prune_data = get_pathspec(revs->prefix, argv + i);
|
revs->prune_data = get_pathspec(revs->prefix, argv + i);
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user