Skip to content

Commit 672abff

Browse files
committed
Merge pull request #231 from kblees/kb/msysgit-2.1.0
Rebasing merge to Git v2.1.0
2 parents 3fa02b8 + 53ee2b9 commit 672abff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1796
-249
lines changed

Documentation/config.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,12 @@ The default is true, except linkgit:git-clone[1] or linkgit:git-init[1]
212212
will probe and set core.fileMode false if appropriate when the
213213
repository is created.
214214

215+
core.hideDotFiles::
216+
(Windows-only) If true (which is the default), mark newly-created
217+
directories and files whose name starts with a dot as hidden.
218+
If 'dotGitOnly', only the .git/ directory is hidden, but no other
219+
files starting with a dot.
220+
215221
core.ignorecase::
216222
If true, this option enables various workarounds to enable
217223
Git to work better on filesystems that are not case sensitive,
@@ -625,6 +631,19 @@ relatively high IO latencies. When enabled, Git will do the
625631
index comparison to the filesystem data in parallel, allowing
626632
overlapping IO's. Defaults to true.
627633

634+
core.fscache::
635+
Enable additional caching of file system data for some operations.
636+
+
637+
Git for Windows uses this to bulk-read and cache lstat data of entire
638+
directories (instead of doing lstat file by file).
639+
640+
core.longpaths::
641+
Enable long path (> 260) support for builtin commands in Git for
642+
Windows. This is disabled by default, as long paths are not supported
643+
by Windows Explorer, cmd.exe and the Git for Windows tool chain
644+
(msys, bash, tcl, perl...). Only enable this if you know what you're
645+
doing and are prepared to live with a few quirks.
646+
628647
core.createObject::
629648
You can set this to 'link', in which case a hardlink followed by
630649
a delete of the source are used to make sure that object creation
@@ -776,6 +795,7 @@ branch.<name>.rebase::
776795
instead of merging the default branch from the default remote when
777796
"git pull" is run. See "pull.rebase" for doing this in a non
778797
branch-specific manner.
798+
When the value is `interactive`, the rebase is run in interactive mode.
779799
+
780800
When preserve, also pass `--preserve-merges` along to 'git rebase'
781801
so that locally committed merge commits will not be flattened
@@ -2076,6 +2096,11 @@ receive.denyCurrentBranch::
20762096
print a warning of such a push to stderr, but allow the push to
20772097
proceed. If set to false or "ignore", allow such pushes with no
20782098
message. Defaults to "refuse".
2099+
+
2100+
There are two more options that are meant for Git experts: "updateInstead"
2101+
which will run `read-tree -u -m HEAD` and "detachInstead" which will detach
2102+
the HEAD so it does not need to change. Both options come with their own
2103+
set of possible *complications*, but can be appropriate in rare workflows.
20792104

20802105
receive.denyNonFastForwards::
20812106
If set to true, git-receive-pack will deny a ref update which is
@@ -2459,3 +2484,9 @@ web.browser::
24592484
Specify a web browser that may be used by some commands.
24602485
Currently only linkgit:git-instaweb[1] and linkgit:git-help[1]
24612486
may use it.
2487+
2488+
sendpack.sideband::
2489+
Allows to disable the side-band-64k capability for send-pack even
2490+
when it is advertised by the server. Makes it possible to work
2491+
around a limitation in the git for windows implementation together
2492+
with the dump git protocol. Defaults to true.

Documentation/git-pull.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Options related to merging
104104
include::merge-options.txt[]
105105

106106
-r::
107-
--rebase[=false|true|preserve]::
107+
--rebase[=false|true|preserve|interactive]::
108108
When true, rebase the current branch on top of the upstream
109109
branch after fetching. If there is a remote-tracking branch
110110
corresponding to the upstream branch and the upstream branch
@@ -117,6 +117,8 @@ locally created merge commits will not be flattened.
117117
+
118118
When false, merge the current branch into the upstream branch.
119119
+
120+
When `interactive`, enable the interactive mode of rebase.
121+
+
120122
See `pull.rebase`, `branch.<name>.rebase` and `branch.autosetuprebase` in
121123
linkgit:git-config[1] if you want to make `git pull` always use
122124
`--rebase` instead of merging.

Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,13 +1148,11 @@ else
11481148
REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
11491149
PROGRAM_OBJS += http-fetch.o
11501150
PROGRAMS += $(REMOTE_CURL_NAMES)
1151-
curl_check := $(shell (echo 070908; curl-config --vernum) 2>/dev/null | sort -r | sed -ne 2p)
1152-
ifeq "$(curl_check)" "070908"
1153-
ifndef NO_EXPAT
1151+
ifndef NO_EXPAT
1152+
ifndef NO_CURL_MULTI
11541153
PROGRAM_OBJS += http-push.o
11551154
endif
1156-
endif
1157-
ifndef NO_EXPAT
1155+
11581156
ifdef EXPATDIR
11591157
BASIC_CFLAGS += -I$(EXPATDIR)/include
11601158
EXPAT_LIBEXPAT = -L$(EXPATDIR)/$(lib) $(CC_LD_DYNPATH)$(EXPATDIR)/$(lib) -lexpat
@@ -1479,6 +1477,9 @@ ifdef NO_REGEX
14791477
COMPAT_CFLAGS += -Icompat/regex
14801478
COMPAT_OBJS += compat/regex/regex.o
14811479
endif
1480+
ifdef NATIVE_CRLF
1481+
BASIC_CFLAGS += -DNATIVE_CRLF
1482+
endif
14821483

14831484
ifdef USE_NED_ALLOCATOR
14841485
COMPAT_CFLAGS += -Icompat/nedmalloc

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Git for Windows
2+
3+
This is the source code of [Git for Windows](http://msysgit.github.io/),
4+
forked from [Git](http://git-scm.com/).
5+
6+
If you encounter problems, you can report them as [GitHub issues](https://github.com/msysgit/git/issues?direction=desc&sort=updated&state=open), discuss them on Git for Windows' [Google Group](http://groups.google.com/group/msysgit), and encourage others to work on by tipping via [![tip for next commit](http://tip4commit.com/projects/295.svg)](http://tip4commit.com/projects/295).

builtin/clone.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
947947
}
948948

949949
if (!is_local && !complete_refs_before_fetch)
950-
transport_fetch_refs(transport, mapped_refs);
950+
if (transport_fetch_refs(transport, mapped_refs))
951+
die(_("could not fetch refs from %s"),
952+
transport->url);
951953

952954
remote_head = find_ref_by_name(refs, "HEAD");
953955
remote_head_points_at =

builtin/commit.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,6 +1368,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
13681368
PATHSPEC_PREFER_FULL,
13691369
prefix, argv);
13701370

1371+
enable_fscache(1);
13711372
read_cache_preload(&s.pathspec);
13721373
refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, &s.pathspec, NULL, NULL);
13731374

builtin/fast-export.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -571,9 +571,20 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info)
571571
}
572572
}
573573

574+
static void handle_reset(const char *name, struct object *object)
575+
{
576+
int mark = get_object_mark(object);
577+
578+
if (mark)
579+
printf("reset %s\nfrom :%d\n\n", name,
580+
get_object_mark(object));
581+
else
582+
printf("reset %s\nfrom %s\n\n", name,
583+
sha1_to_hex(object->sha1));
584+
}
585+
574586
static void handle_tags_and_duplicates(void)
575587
{
576-
struct commit *commit;
577588
int i;
578589

579590
for (i = extra_refs.nr - 1; i >= 0; i--) {
@@ -585,9 +596,7 @@ static void handle_tags_and_duplicates(void)
585596
break;
586597
case OBJ_COMMIT:
587598
/* create refs pointing to already seen commits */
588-
commit = (struct commit *)object;
589-
printf("reset %s\nfrom :%d\n\n", name,
590-
get_object_mark(&commit->object));
599+
handle_reset(name, object);
591600
show_progress();
592601
break;
593602
}

builtin/init-db.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ int init_db(const char *template_dir, unsigned int flags)
385385
check_repository_format();
386386

387387
reinit = create_default_files(template_dir);
388+
mark_as_git_dir(get_git_dir());
388389

389390
create_object_directory();
390391

builtin/receive-pack.c

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ enum deny_action {
2222
DENY_UNCONFIGURED,
2323
DENY_IGNORE,
2424
DENY_WARN,
25-
DENY_REFUSE
25+
DENY_REFUSE,
26+
DENY_UPDATE_INSTEAD,
27+
DENY_DETACH_INSTEAD,
2628
};
2729

2830
static int deny_deletes;
@@ -100,7 +102,12 @@ static int receive_pack_config(const char *var, const char *value, void *cb)
100102
}
101103

102104
if (!strcmp(var, "receive.denycurrentbranch")) {
103-
deny_current_branch = parse_deny_action(var, value);
105+
if (value && !strcasecmp(value, "updateinstead"))
106+
deny_current_branch = DENY_UPDATE_INSTEAD;
107+
else if (value && !strcasecmp(value, "detachinstead"))
108+
deny_current_branch = DENY_DETACH_INSTEAD;
109+
else
110+
deny_current_branch = parse_deny_action(var, value);
104111
return 0;
105112
}
106113

@@ -468,6 +475,44 @@ static int update_shallow_ref(struct command *cmd, struct shallow_info *si)
468475
return 0;
469476
}
470477

478+
static void merge_worktree(unsigned char *sha1)
479+
{
480+
const char *update_refresh[] = {
481+
"update-index", "--ignore-submodules", "--refresh", NULL
482+
};
483+
const char *read_tree[] = {
484+
"read-tree", "-u", "-m", sha1_to_hex(sha1), NULL
485+
};
486+
struct child_process child;
487+
struct strbuf git_env = STRBUF_INIT;
488+
const char *env[2];
489+
490+
if (is_bare_repository())
491+
die ("denyCurrentBranch = updateInstead needs a worktree");
492+
493+
strbuf_addf(&git_env, "GIT_DIR=%s", absolute_path(get_git_dir()));
494+
env[0] = git_env.buf;
495+
env[1] = NULL;
496+
497+
memset(&child, 0, sizeof(child));
498+
child.argv = update_refresh;
499+
child.env = env;
500+
child.dir = git_work_tree_cfg ? git_work_tree_cfg : "..";
501+
child.stdout_to_stderr = 1;
502+
child.git_cmd = 1;
503+
if (run_command(&child))
504+
die ("Could not refresh the index");
505+
506+
child.argv = read_tree;
507+
child.no_stdin = 1;
508+
child.no_stdout = 1;
509+
child.stdout_to_stderr = 0;
510+
if (run_command(&child))
511+
die ("Could not merge working tree with new HEAD. Good luck.");
512+
513+
strbuf_release(&git_env);
514+
}
515+
471516
static const char *update(struct command *cmd, struct shallow_info *si)
472517
{
473518
const char *name = cmd->ref_name;
@@ -499,6 +544,13 @@ static const char *update(struct command *cmd, struct shallow_info *si)
499544
if (deny_current_branch == DENY_UNCONFIGURED)
500545
refuse_unconfigured_deny();
501546
return "branch is currently checked out";
547+
case DENY_UPDATE_INSTEAD:
548+
merge_worktree(new_sha1);
549+
break;
550+
case DENY_DETACH_INSTEAD:
551+
update_ref("push into current branch (detach)", "HEAD",
552+
old_sha1, NULL, REF_NODEREF, UPDATE_REFS_DIE_ON_ERR);
553+
break;
502554
}
503555
}
504556

@@ -527,6 +579,8 @@ static const char *update(struct command *cmd, struct shallow_info *si)
527579
refuse_unconfigured_deny_delete_current();
528580
rp_error("refusing to delete the current branch: %s", name);
529581
return "deletion of the current branch prohibited";
582+
default:
583+
die ("Invalid denyDeleteCurrent setting");
530584
}
531585
}
532586
}

builtin/remote.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ static int add(int argc, const char **argv)
243243
struct branch_info {
244244
char *remote_name;
245245
struct string_list merge;
246-
int rebase;
246+
enum { NO_REBASE, NORMAL_REBASE, INTERACTIVE_REBASE } rebase;
247247
};
248248

249249
static struct string_list branch_list;
@@ -304,6 +304,8 @@ static int config_read_branches(const char *key, const char *value, void *cb)
304304
info->rebase = v;
305305
else if (!strcmp(value, "preserve"))
306306
info->rebase = 1;
307+
else if (!strcmp(value, "interactive"))
308+
info->rebase = INTERACTIVE_REBASE;
307309
}
308310
}
309311
return 0;
@@ -999,7 +1001,9 @@ static int show_local_info_item(struct string_list_item *item, void *cb_data)
9991001

10001002
printf(" %-*s ", show_info->width, item->string);
10011003
if (branch_info->rebase) {
1002-
printf_ln(_("rebases onto remote %s"), merge->items[0].string);
1004+
printf_ln(_(branch_info->rebase == INTERACTIVE_REBASE ?
1005+
"rebases interactively onto remote %s" :
1006+
"rebases onto remote %s"), merge->items[0].string);
10031007
return 0;
10041008
} else if (show_info->any_rebase) {
10051009
printf_ln(_(" merges with remote %s"), merge->items[0].string);

cache.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,17 @@ extern int precomposed_unicode;
641641
extern char comment_line_char;
642642
extern int auto_comment_line_char;
643643

644+
enum hide_dotfiles_type {
645+
HIDE_DOTFILES_FALSE = 0,
646+
HIDE_DOTFILES_TRUE,
647+
HIDE_DOTFILES_DOTGITONLY,
648+
};
649+
extern enum hide_dotfiles_type hide_dotfiles;
650+
651+
extern int core_fscache;
652+
653+
extern int core_long_paths;
654+
644655
enum branch_track {
645656
BRANCH_TRACK_UNSPECIFIED = -1,
646657
BRANCH_TRACK_NEVER = 0,

0 commit comments

Comments
 (0)