Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stdin: Handle directory input #73

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

TanmayPatil105
Copy link
Contributor

When handling stdin, GNU diff now behaves as follows:

  • If a file is input, it displays the current time as m_time
  • If a directory is input, it appends the other file_name to the canonicalized path of directory and reads and displays the m_time of that file

When handling stdin, GNU diff now behaves as follows:
  * If a file is input, it displays the current time as m_time
  * If a directory is input, it appends the other file_name to
    the canonicalized path of directory and reads and displays
    the m_time of that file
Copy link

codecov bot commented May 5, 2024

Codecov Report

Attention: Patch coverage is 47.05882% with 18 lines in your changes are missing coverage. Please review.

Project coverage is 75.12%. Comparing base (d922313) to head (f21689d).

Files Patch % Lines
src/params.rs 35.71% 5 Missing and 4 partials ⚠️
src/context_diff.rs 42.85% 2 Missing and 2 partials ⚠️
src/unified_diff.rs 42.85% 2 Missing and 2 partials ⚠️
src/main.rs 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #73      +/-   ##
==========================================
- Coverage   75.46%   75.12%   -0.35%     
==========================================
  Files          10       10              
  Lines        2935     2959      +24     
  Branches      745      754       +9     
==========================================
+ Hits         2215     2223       +8     
- Misses        547      557      +10     
- Partials      173      179       +6     
Flag Coverage Δ
macos_latest 75.86% <47.05%> (-0.36%) ⬇️
ubuntu_latest 75.10% <44.11%> (-0.36%) ⬇️
windows_latest 15.44% <45.83%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@TanmayPatil105
Copy link
Contributor Author

Okay, now this is tricky! There is no /dev/stdin on windows.

@TanmayPatil105
Copy link
Contributor Author

Hey @oSoMoN , can you review this PR?

@oSoMoN
Copy link
Collaborator

oSoMoN commented Jun 4, 2024

Sorry for the long delay @TanmayPatil105, I haven't had time to dedicate to this project in the last few weeks.
So what exactly is the use case you're addressing here? How would one pass a directory as stdin on the command line?
Also, could you please add an integration test for that use case?

@TanmayPatil105
Copy link
Contributor Author

TanmayPatil105 commented Jun 8, 2024

So what exactly is the use case you're addressing here? How would one pass a directory as stdin on the command line?

Yeah, that is highly unlikely. However, since GNU diff 3.9, it has started handling redirected directory inputs. Additionally, this has also been included in the tests http://git.savannah.gnu.org/cgit/diffutils.git/tree/tests/stdin#n27.

Also, could you please add an integration test for that use case?

I had a go on it but I don't think so there's a way to redirect a directory as input through code. Is there a way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants