Commit 2270ca9f by David Turner

rebase: ignore untracked files in submodules

An untracked file in a submodule should not prevent a rebase from
starting.  Even if the submodule's SHA is changed, and that file would
conflict with a new tracked file, it's still OK to start the rebase
and discover the conflict later.

Signed-off-by: David Turner <dturner@twosigma.com>
parent 467185ff
......@@ -546,7 +546,9 @@ static int rebase_ensure_not_dirty(
}
if (check_workdir) {
if ((error = git_diff_index_to_workdir(&diff, repo, index, NULL)) < 0)
git_diff_options diff_opts = GIT_DIFF_OPTIONS_INIT;
diff_opts.ignore_submodules = GIT_SUBMODULE_IGNORE_UNTRACKED;
if ((error = git_diff_index_to_workdir(&diff, repo, index, &diff_opts)) < 0)
goto done;
if (git_diff_num_deltas(diff) > 0) {
......
#include "clar_libgit2.h"
#include "git2/checkout.h"
#include "git2/rebase.h"
#include "posix.h"
#include "signature.h"
#include <fcntl.h>
static git_repository *repo;
static git_signature *signature;
// Fixture setup and teardown
void test_rebase_submodule__initialize(void)
{
repo = cl_git_sandbox_init("rebase-submodule");
cl_git_pass(git_signature_new(&signature,
"Rebaser", "rebaser@rebaser.rb", 1405694510, 0));
}
void test_rebase_submodule__cleanup(void)
{
git_signature_free(signature);
cl_git_sandbox_cleanup();
}
void test_rebase_submodule__init_untracked(void)
{
git_rebase *rebase;
git_reference *branch_ref, *upstream_ref;
git_annotated_commit *branch_head, *upstream_head;
git_buf untracked_path = GIT_BUF_INIT;
FILE *fp;
git_submodule *submodule;
git_config *config;
cl_git_pass(git_reference_lookup(&branch_ref, repo, "refs/heads/asparagus"));
cl_git_pass(git_reference_lookup(&upstream_ref, repo, "refs/heads/master"));
cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref));
cl_git_pass(git_annotated_commit_from_ref(&upstream_head, repo, upstream_ref));
git_repository_config(&config, repo);
cl_git_pass(git_config_set_string(config, "submodule.my-submodule.url", git_repository_path(repo)));
git_config_free(config);
cl_git_pass(git_submodule_lookup(&submodule, repo, "my-submodule"));
cl_git_pass(git_submodule_update(submodule, 1, NULL));
git_buf_printf(&untracked_path, "%s/my-submodule/untracked", git_repository_workdir(repo));
fp = fopen(git_buf_cstr(&untracked_path), "w");
fprintf(fp, "An untracked file in a submodule should not block a rebase\n");
fclose(fp);
git_buf_free(&untracked_path);
cl_git_pass(git_rebase_init(&rebase, repo, branch_head, upstream_head, NULL, NULL));
git_submodule_free(submodule);
git_annotated_commit_free(branch_head);
git_annotated_commit_free(upstream_head);
git_reference_free(branch_ref);
git_reference_free(upstream_ref);
git_rebase_free(rebase);
}
[submodule "my-submodule"]
path = my-submodule
url = bogus
5fdf086684daae0a8bc61a81afe178edc1e556e7
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[branch "asparagus"]
rebase = true
[branch "master"]
rebase = true
Unnamed repository; edit this file 'description' to name the repository.
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
c64ea52df5b31efd7b73769418dc9e25b8803d25 refs/heads/asparagus
c64ea52df5b31efd7b73769418dc9e25b8803d25 refs/remotes/origin/HEAD
c64ea52df5b31efd7b73769418dc9e25b8803d25 refs/remotes/origin/asparagus
02a35db3f24db554b757b3009bc782784267c743 refs/remotes/origin/master
# pack-refs with: peeled fully-peeled
c64ea52df5b31efd7b73769418dc9e25b8803d25 refs/heads/asparagus
01971e2453a407e4b9f6c865e2c37f4db21da294
ASPARAGUS SOUP.
Take four large bunches of asparagus, scrape it nicely, cut off one inch
of the tops, and lay them in water, chop the stalks and put them on the
fire with a piece of bacon, a large onion cut up, and pepper and salt;
add two quarts of water, boil them till the stalks are quite soft, then
pulp them through a sieve, and strain the water to it, which must be put
back in the pot; put into it a chicken cut up, with the tops of
asparagus which had been laid by, boil it until these last articles are
sufficiently done, thicken with flour, butter and milk, and serve it up.
BEEF SOUP.
Take the hind shin of beef, cut off all the flesh off the leg-bone,
which must be taken away entirely, or the soup will be greasy. Wash the
meat clean and lay it in a pot, sprinkle over it one small
table-spoonful of pounded black pepper, and two of salt; three onions
the size of a hen's egg, cut small, six small carrots scraped and cut
up, two small turnips pared and cut into dice; pour on three quarts of
water, cover the pot close, and keep it gently and steadily boiling five
hours, which will leave about three pints of clear soup; do not let the
pot boil over, but take off the scum carefully, as it rises. When it has
boiled four hours, put in a small bundle of thyme and parsley, and a
pint of celery cut small, or a tea-spoonful of celery seed pounded.
These latter ingredients would lose their delicate flavour if boiled too
much. Just before you take it up, brown it in the following manner: put
a small table-spoonful of nice brown sugar into an iron skillet, set it
on the fire and stir it till it melts and looks very dark, pour into it
a ladle full of the soup, a little at a time; stirring it all the while.
Strain this browning and mix it well with the soup; take out the bundle
of thyme and parsley, put the nicest pieces of meat in your tureen, and
pour on the soup and vegetables; put in some toasted bread cut in dice,
and serve it up.
SOUP WITH BOUILLI.
Take the nicest part of the thick brisket of beef, about eight pounds,
put it into a pot with every thing directed for the other soup; make it
exactly in the same way, only put it on an hour sooner, that you may
have time to prepare the bouilli; after it has boiled five hours, take
out the beef, cover up the soup and set it near the fire that it may
keep hot. Take the skin off the beef, have the yelk of an egg well
beaten, dip a feather in it and wash the top of your beef, sprinkle over
it the crumb of stale bread finely grated, put it in a Dutch oven
previously heated, put the top on with coals enough to brown, but not
burn the beef; let it stand nearly an hour, and prepare your gravy
thus:--Take a sufficient quantity of soup and the vegetables boiled in
it; add to it a table-spoonful of red wine, and two of mushroom catsup,
thicken with a little bit of butter and a little brown flour; make it
very hot, pour it in your dish, and put the beef on it. Garnish it with
green pickle, cut in thin slices, serve up the soup in a tureen with
bits of toasted bread.
GRAVY SOUP.
Get eight pounds of coarse lean beef--wash it clean and lay it in your
pot, put in the same ingredients as for the shin soup, with the same
quantity of water, and follow the process directed for that. Strain the
soup through a sieve, and serve it up clear, with nothing more than
toasted bread in it; two table-spoonsful of mushroom catsup will add a
fine flavour to the soup.
my-submodule @ efad0b11
Subproject commit efad0b11c47cb2f0220cbd6f5b0f93bb99064b00
OYSTER SOUP.
Wash and drain two quarts of oysters, put them on with three quarts of
water, three onions chopped up, two or three slices of lean ham, pepper
and salt; boil it till reduced one-half, strain it through a sieve,
return the liquid into the pot, put in one quart of fresh oysters, boil
it till they are sufficiently done, and thicken the soup with four
spoonsful of flour, two gills of rich cream, and the yelks of six new
laid eggs beaten well; boil it a few minutes after the thickening is put
in. Take care that it does not curdle, and that the flour is not in
lumps; serve it up with the last oysters that were put in. If the
flavour of thyme be agreeable, you may put in a little, but take care
that it does not boil in it long enough to discolour the soup.
VEAL SOUP.
Put into a pot three quarts of water, three onions cut small, one
spoonful of black pepper pounded, and two of salt, with two or three
slices of lean ham; let it boil steadily two hours; skim it
occasionally, then put into it a shin of veal, let it boil two hours
longer; take out the slices of ham, and skim off the grease if any
should rise, take a gill of good cream, mix with it two table-spoonsful
of flour very nicely, and the yelks of two eggs beaten well, strain this
mixture, and add some chopped parsley; pour some soup on by degrees,
stir it well, and pour it into the pot, continuing to stir until it has
boiled two or three minutes to take off the raw taste of the eggs. If
the cream be not perfectly sweet, and the eggs quite new, the thickening
will curdle in the soup. For a change you may put a dozen ripe tomatos
in, first taking off their skins, by letting them stand a few minutes in
hot water, when they may be easily peeled. When made in this way you
must thicken it with the flour only. Any part of the veal may be used,
but the shin or knuckle is the nicest.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment