Skip to content

Added advice for files which are >50 mb#2221

Closed
Arsh123344423 wants to merge 10 commits intogit:masterfrom
Arsh123344423:Add_Advice_large_File
Closed

Added advice for files which are >50 mb#2221
Arsh123344423 wants to merge 10 commits intogit:masterfrom
Arsh123344423:Add_Advice_large_File

Conversation

@Arsh123344423
Copy link
Copy Markdown

@Arsh123344423 Arsh123344423 commented Mar 3, 2026

No description provided.

@gitgitgadget-git
Copy link
Copy Markdown

Welcome to GitGitGadget

Hi @Arsh123344423, and welcome to GitGitGadget, the GitHub App to send patch series to the Git mailing list from GitHub Pull Requests.

Please make sure that either:

  • Your Pull Request has a good description, if it consists of multiple commits, as it will be used as cover letter.
  • Your Pull Request description is empty, if it consists of a single commit, as the commit message should be descriptive enough by itself.

You can CC potential reviewers by adding a footer to the PR description with the following syntax:

CC: Revi Ewer <revi.ewer@example.com>, Ill Takalook <ill.takalook@example.net>

NOTE: DO NOT copy/paste your CC list from a previous GGG PR's description,
because it will result in a malformed CC list on the mailing list. See
example.

Also, it is a good idea to review the commit messages one last time, as the Git project expects them in a quite specific form:

  • the lines should not exceed 76 columns,
  • the first line should be like a header and typically start with a prefix like "tests:" or "revisions:" to state which subsystem the change is about, and
  • the commit messages' body should be describing the "why?" of the change.
  • Finally, the commit messages should end in a Signed-off-by: line matching the commits' author.

It is in general a good idea to await the automated test ("Checks") in this Pull Request before contributing the patches, e.g. to avoid trivial issues such as unportable code.

Contributing the patches

Before you can contribute the patches, your GitHub username needs to be added to the list of permitted users. Any already-permitted user can do that, by adding a comment to your PR of the form /allow. A good way to find other contributors is to locate recent pull requests where someone has been /allowed:

Both the person who commented /allow and the PR author are able to /allow you.

An alternative is the channel #git-devel on the Libera Chat IRC network:

<newcontributor> I've just created my first PR, could someone please /allow me? https://github.com/gitgitgadget/git/pull/12345
<veteran> newcontributor: it is done
<newcontributor> thanks!

Once on the list of permitted usernames, you can contribute the patches to the Git mailing list by adding a PR comment /submit.

If you want to see what email(s) would be sent for a /submit request, add a PR comment /preview to have the email(s) sent to you. You must have a public GitHub email address for this. Note that any reviewers CC'd via the list in the PR description will not actually be sent emails.

After you submit, GitGitGadget will respond with another comment that contains the link to the cover letter mail in the Git mailing list archive. Please make sure to monitor the discussion in that thread and to address comments and suggestions (while the comments and suggestions will be mirrored into the PR by GitGitGadget, you will still want to reply via mail).

If you do not want to subscribe to the Git mailing list just to be able to respond to a mail, you can download the mbox from the Git mailing list archive (click the (raw) link), then import it into your mail program. If you use GMail, you can do this via:

curl -g --user "<EMailAddress>:<Password>" \
    --url "imaps://imap.gmail.com/INBOX" -T /path/to/raw.txt

To iterate on your change, i.e. send a revised patch or patch series, you will first want to (force-)push to the same branch. You probably also want to modify your Pull Request description (or title). It is a good idea to summarize the revision by adding something like this to the cover letter (read: by editing the first comment on the PR, i.e. the PR description):

Changes since v1:
- Fixed a typo in the commit message (found by ...)
- Added a code comment to ... as suggested by ...
...

To send a new iteration, just add another PR comment with the contents: /submit.

Need help?

New contributors who want advice are encouraged to join git-mentoring@googlegroups.com, where volunteers who regularly contribute to Git are willing to answer newbie questions, give advice, or otherwise provide mentoring to interested contributors. You must join in order to post or view messages, but anyone can join.

You may also be able to find help in real time in the developer IRC channel, #git-devel on Libera Chat. Remember that IRC does not support offline messaging, so if you send someone a private message and log out, they cannot respond to you. The scrollback of #git-devel is archived, though.

@gitgitgadget-git
Copy link
Copy Markdown

Invalid author email in 8e61420: "74533805+Arsh123344423@users.noreply.github.com"

@Arsh123344423
Copy link
Copy Markdown
Author

/allow

@gitgitgadget-git
Copy link
Copy Markdown

Error: User Arsh123344423 is not yet permitted to use GitGitGadget

@dscho
Copy link
Copy Markdown
Member

dscho commented Mar 6, 2026

/allow

@gitgitgadget-git
Copy link
Copy Markdown

User Arsh123344423 is now allowed to use GitGitGadget.

WARNING: Arsh123344423 has no public email address set on GitHub; GitGitGadget needs an email address to Cc: you on your contribution, so that you receive any feedback on the Git mailing list. Go to https://github.com/settings/profile to make your preferred email public to let GitGitGadget know which email address to use.

@dscho
Copy link
Copy Markdown
Member

dscho commented Mar 6, 2026

@Arsh123344423 did you see the CI failures? There is at least a missing prototype:

[...]
  Error: advice.c:317:6: no previous prototype for 'advise_on_large_file' [-Werror=missing-prototypes]
   void advise_on_large_file(const char *path, off_t size)
        ^~~~~~~~~~~~~~~~~~~~

Which means that the function either needs to be declared static, or exported via advice.h.

@Arsh123344423
Copy link
Copy Markdown
Author

@dscho thank you so much for looking into my pr and giving me the access to allow , nevertheless I saw the issue and I am trying to fix it as it's my first contribution and micro project for GSOC it will be an absolute honor if you help me out to fix this issue
Thank you

@dscho
Copy link
Copy Markdown
Member

dscho commented Mar 7, 2026

Well, you will notice that the advise_on_large_file() function you introduced is only ever called inside advice.c. This is important because if it were used somewhere else it would have to be declared first. That's what this compile error is about. It has to be declared if it has to be called somewhere else so that it can be ensured that the function signature of declaration and the implementation match.

Since the function is only called inside advice.c, you are free to actually define it directly without a prior declaration. In that case, however, you have to mark the function such that it cannot be used outside of that file. That is what this static keyword is all about. See e.g.

git/advice.c

Line 21 in 67ad421

static int parse_advise_color_slot(const char *slot)
which defines the parse_advise_color_slot() function as static, i.e. it can only be called in the same file, after it has been defined.

Once you understand this issue, it's very easy to fix it. I want to prevent you not understanding it and just making edits that I tell you because that's missing the point of the micro project.

@gitgitgadget-git
Copy link
Copy Markdown

Invalid author email in 8e61420: "74533805+Arsh123344423@users.noreply.github.com"

@gitgitgadget-git
Copy link
Copy Markdown

Invalid author email in 2c7be81: "74533805+Arsh123344423@users.noreply.github.com"

@gitgitgadget-git
Copy link
Copy Markdown

Invalid author email in 8e61420: "74533805+Arsh123344423@users.noreply.github.com"

@gitgitgadget-git
Copy link
Copy Markdown

Invalid author email in 2c7be81: "74533805+Arsh123344423@users.noreply.github.com"

@gitgitgadget-git
Copy link
Copy Markdown

Invalid author email in 2c724c5: "74533805+Arsh123344423@users.noreply.github.com"

@Arsh123344423 Arsh123344423 force-pushed the Add_Advice_large_File branch from 2c724c5 to cec015b Compare March 7, 2026 07:25
@gitgitgadget-git
Copy link
Copy Markdown

Invalid author email in 8e61420: "74533805+Arsh123344423@users.noreply.github.com"

@gitgitgadget-git
Copy link
Copy Markdown

Invalid author email in 2c7be81: "74533805+Arsh123344423@users.noreply.github.com"

@gitgitgadget-git
Copy link
Copy Markdown

Invalid author email in 8e61420: "74533805+Arsh123344423@users.noreply.github.com"

@gitgitgadget-git
Copy link
Copy Markdown

Invalid author email in 2c7be81: "74533805+Arsh123344423@users.noreply.github.com"

@gitgitgadget-git
Copy link
Copy Markdown

Invalid author email in 39c1ed5: "74533805+Arsh123344423@users.noreply.github.com"

@gitgitgadget-git
Copy link
Copy Markdown

Invalid author email in 8e61420: "74533805+Arsh123344423@users.noreply.github.com"

@gitgitgadget-git
Copy link
Copy Markdown

Invalid author email in 2c7be81: "74533805+Arsh123344423@users.noreply.github.com"

@gitgitgadget-git
Copy link
Copy Markdown

Invalid author email in 39c1ed5: "74533805+Arsh123344423@users.noreply.github.com"

@gitgitgadget-git
Copy link
Copy Markdown

Invalid author email in 643e808: "74533805+Arsh123344423@users.noreply.github.com"

@gitgitgadget-git
Copy link
Copy Markdown

Invalid author email in 8e61420: "74533805+Arsh123344423@users.noreply.github.com"

@gitgitgadget-git
Copy link
Copy Markdown

Invalid author email in 2c7be81: "74533805+Arsh123344423@users.noreply.github.com"

@gitgitgadget-git
Copy link
Copy Markdown

Invalid author email in 39c1ed5: "74533805+Arsh123344423@users.noreply.github.com"

@gitgitgadget-git
Copy link
Copy Markdown

There are issues in commit d2a3118:
Initial commit

  • Commit checks stopped - the message is too short
  • Commit not signed off

@gitgitgadget-git
Copy link
Copy Markdown

There are issues in commit 5d57758:
Made the fuction static so that it can only be accessed inside the file

  • Commit checks stopped - the message is too short
  • Commit not signed off

@gitgitgadget-git
Copy link
Copy Markdown

There are issues in commit 596602b:
added EOD char

  • Commit checks stopped - the message is too short
  • Commit not signed off

@gitgitgadget-git
Copy link
Copy Markdown

There are issues in commit 795c4ba:
used the function at read-cache.c inside add_file_to_index to show a disclamier

  • Commit checks stopped - the message is too short
  • First line of commit message is too long (> 76 columns)
  • Commit not signed off

@gitgitgadget-git
Copy link
Copy Markdown

There are issues in commit 852e8a6:
fixed the import issue

  • Commit checks stopped - the message is too short
  • Commit not signed off

@gitgitgadget-git
Copy link
Copy Markdown

There are issues in commit 4740331:
fixed the import issue wrong file name

  • Commit checks stopped - the message is too short
  • Commit not signed off

@gitgitgadget-git
Copy link
Copy Markdown

There are issues in commit 79019d0:
fixed the import issue wrong file name

  • Commit checks stopped - the message is too short
  • Commit not signed off

@gitgitgadget-git
Copy link
Copy Markdown

There are issues in commit 30f98e6:
made the function static again

  • Commit checks stopped - the message is too short
  • Commit not signed off

@gitgitgadget-git
Copy link
Copy Markdown

There are issues in commit ad88485:
After passing all tests

  • Commit checks stopped - the message is too short
  • Commit not signed off

@gitgitgadget-git
Copy link
Copy Markdown

There are issues in commit 0f70732:
fixed all test cases finally

  • Commit checks stopped - the message is too short
  • Commit not signed off

Introduce a new function to advise users when they attempt to stage
large files (>50MB). This function will display a warning message
suggesting the use of Git LFS or adding the file to .gitignore.

Signed-off-by: Arsh Srivastava <arshsrivastava00@gmail.com>
Make the function static to limit its scope to the advice.c file,
following encapsulation best practices.

Signed-off-by: Arsh Srivastava <arshsrivastava00@gmail.com>
Ensure advice.c ends with a newline character to comply with
POSIX standards and Git coding guidelines.

Signed-off-by: Arsh Srivastava <arshsrivastava00@gmail.com>
Call advise_on_large_file() from add_file_to_index() in read-cache.c
to warn users when staging files larger than 50MB. This helps prevent
accidentally committing large files to the repository.

Signed-off-by: Arsh Srivastava <arshsrivastava00@gmail.com>
Correct the header file include to properly reference advice.h,
resolving compilation errors.

Signed-off-by: Arsh Srivastava <arshsrivastava00@gmail.com>
Fix the function declaration in advice.h to match the implementation
in advice.c, resolving type mismatch errors.

Signed-off-by: Arsh Srivastava <arshsrivastava00@gmail.com>
Clean up redundant header file includes in read-cache.c to avoid
compilation warnings.

Signed-off-by: Arsh Srivastava <arshsrivastava00@gmail.com>
Make advise_on_large_file a public function by removing the static
keyword, allowing it to be called from other source files.

Signed-off-by: Arsh Srivastava <arshsrivastava00@gmail.com>
Clean up trailing whitespace, ensure proper tab indentation, and
add missing newlines to comply with Git project coding standards.
All tests now pass successfully.

Signed-off-by: Arsh Srivastava <arshsrivastava00@gmail.com>
Clean up trailing whitespace, ensure proper tab indentation, and
add missing newlines to comply with Git project coding standards.
fixed all test cases finally.
All tests now pass successfully.

Signed-off-by: Arsh Srivastava <arshsrivastava00@gmail.com>
@dscho
Copy link
Copy Markdown
Member

dscho commented Mar 8, 2026

@dscho can you help me out here all testcases are passing except whitespace, handle_pr_push even though i have applied the recommended fix

Well, you have 10 commits in this PR, for the price of one.

You'll need to clean up the commit history. Easiest way: https://git-rebase.io/

@dscho
Copy link
Copy Markdown
Member

dscho commented Mar 8, 2026

And of course you'll want to reopen this PR, force-push, and for a single commit you don't need a cover letter (read: the PR description can stay empty).

@Arsh123344423
Copy link
Copy Markdown
Author

@dscho I will create another pr that will be cleaner and more concise as this one i don't know why but has 2490 changes which is ridiculous , mind my words I won't stop until I get my micro project accepted but this one is practically dead I believe , but if there is still a way for me to make this pr a reality I will

@dscho
Copy link
Copy Markdown
Member

dscho commented Mar 8, 2026

I don't like seeing multiple PRs when one suffices. Same thing as seeing 10 commits when one would be better.

@Arsh123344423
Copy link
Copy Markdown
Author

Arsh123344423 commented Mar 8, 2026

@dscho okay so I will try to find a way to overcome these problems , in this pr only

@Arsh123344423
Copy link
Copy Markdown
Author

Arsh123344423 commented Mar 8, 2026

@dscho as this pr is already moved to the done portion is their any way for me to get it back?

There's a "Reopen" button on the bottom, no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants