Skip to content
Snippets Groups Projects
Commit f9f99b3f authored by Johannes Schindelin's avatar Johannes Schindelin Committed by Junio C Hamano
Browse files

Deprecate support for .git/info/grafts


The grafts feature was a convenient way to "stitch together" ancient
history to the fresh start of linux.git.

Its implementation is, however, not up to Git's standards, as there are
too many ways where it can lead to surprising and unwelcome behavior.

For example, when pushing from a repository with active grafts, it is
possible to miss commits that have been "grafted out", resulting in a
broken state on the other side.

Also, the grafts feature is limited to "rewriting" commits' list of
parents, it cannot replace anything else.

The much younger feature implemented as `git replace` set out to remedy
those limitations and dangerous bugs.

Seeing as `git replace` is pretty mature by now (since 4228e8bc
(replace: add --graft option, 2014-07-19) it can perform the graft
file's duties), it is time to deprecate support for the graft file, and
to retire it eventually.

Signed-off-by: default avatarJohannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: default avatarStefan Beller <sbeller@google.com>
Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
parent 0115e030
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -19,6 +19,7 @@ int advice_rm_hints = 1;
int advice_add_embedded_repo = 1;
int advice_ignored_hook = 1;
int advice_waiting_for_editor = 1;
int advice_graft_file_deprecated = 1;
 
static struct {
const char *name;
Loading
Loading
@@ -42,6 +43,7 @@ static struct {
{ "addembeddedrepo", &advice_add_embedded_repo },
{ "ignoredhook", &advice_ignored_hook },
{ "waitingforeditor", &advice_waiting_for_editor },
{ "graftfiledeprecated", &advice_graft_file_deprecated },
 
/* make this an alias for backward compatibility */
{ "pushnonfastforward", &advice_push_update_rejected }
Loading
Loading
Loading
Loading
@@ -21,6 +21,7 @@ extern int advice_rm_hints;
extern int advice_add_embedded_repo;
extern int advice_ignored_hook;
extern int advice_waiting_for_editor;
extern int advice_graft_file_deprecated;
 
int git_default_advice_config(const char *var, const char *value);
__attribute__((format (printf, 1, 2)))
Loading
Loading
Loading
Loading
@@ -12,6 +12,7 @@
#include "prio-queue.h"
#include "sha1-lookup.h"
#include "wt-status.h"
#include "advice.h"
 
static struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **);
 
Loading
Loading
@@ -176,6 +177,15 @@ static int read_graft_file(const char *graft_file)
struct strbuf buf = STRBUF_INIT;
if (!fp)
return -1;
if (advice_graft_file_deprecated)
advise(_("Support for <GIT_DIR>/info/grafts is deprecated\n"
"and will be removed in a future Git version.\n"
"\n"
"Please use \"git replace --convert-graft-file\"\n"
"to convert the grafts into replace refs.\n"
"\n"
"Turn this message off by running\n"
"\"git config advice.graftFileDeprecated false\""));
while (!strbuf_getwholeline(&buf, fp, '\n')) {
/* The format is just "Commit Parent1 Parent2 ...\n" */
struct commit_graft *graft = read_graft_line(&buf);
Loading
Loading
Loading
Loading
@@ -110,4 +110,13 @@ do
"
 
done
test_expect_success 'show advice that grafts are deprecated' '
git show HEAD 2>err &&
test_i18ngrep "git replace" err &&
test_config advice.graftFileDeprecated false &&
git show HEAD 2>err &&
test_i18ngrep ! "git replace" err
'
test_done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment